For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > March 2008 > ANN: Seed7 Release 2008-02-17









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ANN: Seed7 Release 2008-02-17
thomas.mertes@gmx.at

2008-02-17, 7:47 pm

Hello,

I have released a new version of Seed7: seed7_05_20080217.tgz

In the Seed7 programming language new statements and operators
can be declared easily. Types are first class objects and therefore
templates/generics need no special syntax. Object orientation is
used when it brings advantages and not in places when other
solutions are more obvious.

Seed7 is covered by the GPL (and LGPL for the Seed7 runtime library).

Changelog:
- A new chapter about object orientation was added to the manual
(Many thanks for the feedback to Leonardo Cecchi, Malcolm McLean
and Reinder Verlinde).
- The manual was changed to mention that the 'in' parameter of arrays
and structs is a reference ('ref') parameter.
- The faq was improved to contain a paragraph about static type
checking.
- The implementation type NULL_FILE was renamed to null_file.
- The struct copy of the compiler (comp.sd7) was changed to leave the
dynamic type unchanged.
- The following primitive actions were added or improved in the
compiler (comp.sd7): FIL_ERR, FIL_IN, FIL_OUT, FLT_GROW, FLT_MCPY,
HSH_INCL, HSH_LNG, INT_PLUS, PRG_EXEC, PRG_STR_ANALYZE, SCR_CURSOR
and STR_GETENV.
- The primitive action CLS_CREATE2 was changed to call the
CLEAR_TEMP_FLAG macro (This is a fix for a bug found by
Leonardo Cecchi).
- The function match_subexpr_type was changed to allow normal (not
DYNAMIC) interface functions to be used for implementation values.
- The primitive action PRC_GETENV was renamed to STR_GETENV.
- The bas7.sd7 (basic interpreter) example program was improved.
- A bug in the primitive action RFL_NOT_ELEM was fixed.
- The functions copy_list, array_to_list and struct_to_list were
change to return thecreated list.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch.
Bart

2008-02-18, 7:21 pm

On Feb 17, 10:13=A0pm, thomas.mer...@gmx.at wrote:


[From Seed 7 FAQ]
>Variables with object types contain references to object values....
> a :=3D b


>For primitive types a different logic is used...
> a :=3D b
>both variables are still distinct and changing one variable has no effect o=

n the other.

This is more of a general question about a:=3Db for a class object being
different from a:=3Db for an ordinary object. It seems to be the case in
several oo languages.

Why?

OK, objects are implemented by reference and all that, and maybe this
saves some copying, but that should all be transparent.

Surely the meaning of something as basic as a:=3Db should not depend on
something as arbitrary as whether a and b have datatypes T or U. If
someone changes their mind then a lot of recoding might be needed!

--
Bart
thomas.mertes@gmx.at

2008-02-19, 7:35 pm

On 18 Feb., 22:02, Bart <b...@freeuk.com> wrote:
> On Feb 17, 10:13 pm, thomas.mer...@gmx.at wrote:
>
> [From Seed 7 FAQ]
>
>
> This is more of a general question about a:=b for a class object being
> different from a:=b for an ordinary object. It seems to be the case in
> several oo languages.
>
> Why?

IMHO it is a cornerstone of classic OO programming languages
like Smalltalk and its descendants: Object variables and
parameters contain just pointers to the actual object value
which is at the heap. It is almost not mentioned by OO
proponents but in classic OO programming not everything is
done with methods. Assignments are always done as pointer
assignments, independend of the object class. Also comparisons
are done as pointer comparisons. Therefore a 'clone' method
to do deep copies and an 'compare' method to do logical
comparisons is necessary.

The advantage of this OO pointer philosophy is that container
classes are easier to implement (they store just pointers in
the container).

> OK, objects are implemented by reference and all that, and maybe this
> saves some copying, but that should all be transparent.
>
> Surely the meaning of something as basic as a:=b should not depend on
> something as arbitrary as whether a and b have datatypes T or U. If
> someone changes their mind then a lot of recoding might be needed!


Most OO programmers have the different assignment logic for
object variables in their mind. They would be when
those assignments would work as deep copies (As Seed7 does
for all other types).

IIRC Simula had two different assignment operators:
:= For value copy assignments
:- For reference assignments

Seed7 is an extensible programming language.
It would be possible to define the assignment to do a (deep)
copy of the implementation (object) value and to have
a different operator to do reference assignment.

I don't belive that OO fan's would be happy without
reference assignment?

What do you think?

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch.
Bartc

2008-02-19, 7:35 pm

thomas.mertes@gmx.at wrote:
> On 18 Feb., 22:02, Bart <b...@freeuk.com> wrote:
> IMHO it is a cornerstone of classic OO programming languages
> like Smalltalk and its descendants: Object variables and
> parameters contain just pointers to the actual object value
> which is at the heap. It is almost not mentioned by OO
> proponents but in classic OO programming not everything is
> done with methods. Assignments are always done as pointer
> assignments, independend of the object class. Also comparisons
> are done as pointer comparisons. Therefore a 'clone' method
> to do deep copies and an 'compare' method to do logical
> comparisons is necessary.
>
> The advantage of this OO pointer philosophy is that container
> classes are easier to implement (they store just pointers in
> the container).
>
>
> Most OO programmers have the different assignment logic for
> object variables in their mind. They would be when
> those assignments would work as deep copies (As Seed7 does
> for all other types).
>
> IIRC Simula had two different assignment operators:
> := For value copy assignments
> :- For reference assignments
>
> Seed7 is an extensible programming language.
> It would be possible to define the assignment to do a (deep)
> copy of the implementation (object) value and to have
> a different operator to do reference assignment.
>
> I don't belive that OO fan's would be happy without
> reference assignment?
>
> What do you think?


I think it's a bit late to change things now.

I suppose I just have to think about objects as pointers instead, with
whatever they're pointing to being automatically managed:

ptrA := ptrB ( programming equivalent of training wheels :-)

--
Bart



Captain Tony Valare

2008-03-26, 7:43 pm

As t may be applied to a recursion,

ptrA := ptrB

is possibly the only way to fly. I have been reading on the topic of data
structures, and one author who i located in the group being sold at
powells.com. Any comment on this book note written by his publisher?

While many computer science textbooks are confined to teaching programming
code and languages, Algorithms and Data Structures: The Science of Computing
takes a step back to introduce and explore algorithms - the content of the
code. Focusing on three core topics: design (the architecture of
algorithms), theory (mathematical modeling and analysis), and the scientific
method (experimental confirmation of theoretical results), the book helps
students see that computer science is about problem solving, not simply the
memorization and recitation of languages. Unlike many other texts, the
methods of inquiry are explained in an integrated manner so students can see
explicitly how they interact. Recursion and object oriented programming are
emphasized as the main control structure and abstraction mechanism,
respectively, in algorithm design. Designed for the CS2 course, the book
includes text exercises and has laboratory exercises at the supplemental Web
site.

Saturday's 6 $million Dubai World Cup race features Curlin. He ran a good
one on the track last month. Now he's back for all the marble. coverage in
today's Handicapper's edge at
http://www.tsnhorse.com/cgi-bin/edi...ull_edition.cgi

GL at the races


"Bartc" <bc@freeuk.com> wrote in message
news:iQJuj.10236$XI.7988@text.news.virginmedia.com...
> thomas.mertes@gmx.at wrote:
>
> I think it's a bit late to change things now.
>
> I suppose I just have to think about objects as pointers instead, with
> whatever they're pointing to being automatically managed:
>
> ptrA := ptrB ( programming equivalent of training wheels :-)
>
> --
> Bart
>
>
>



Captain Tony Valare

2008-03-26, 10:52 pm

With recursion being a main control structure, as the author suggests,
somewhere I missed the boat. I've never used recursion except once in a
prime number analysis algorithm from a programming book. It said that epime
numbers were a combination of prime factors (which makes sense), so to find
the primes the algorithm factor all the factors, so it used the same few
steps and substituted the last prime factors by calling the function
recursively. I might see how this is practical in two dimensional arrays
i.e., linear optimization algorithms.. It would seem good to process the
bit maps that draw the screen.

Those seem to be structures which fit the use of a recussive algorithm. The
data structure is supposed to meet the requirement of the programming
problem to be solved. so anybody know any prime numbers for analyzing. I
gotr just the control structure for that!

"Bartc" <bc@freeuk.com> wrote in message
news:iQJuj.10236$XI.7988@text.news.virginmedia.com...
> thomas.mertes@gmx.at wrote:
[color=darkred]
>
>



Richard Heathfield

2008-03-27, 5:13 am

Captain Tony Valare said:

> With recursion being a main control structure, as the author suggests,
> somewhere I missed the boat. I've never used recursion except once in a
> prime number analysis algorithm from a programming book. It said that
> epime numbers were a combination of prime factors (which makes sense),


No, it makes no sense at all. Primes /are/ prime factors. They are not
combinations of anything. That is practically the definition of primes!

Exercise: here are the first ten primes: 2, 3, 5, 7, 11, 13, 17, 19, 23,
29. List their prime factors.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Richard Harter

2008-03-27, 5:13 am

On Thu, 27 Mar 2008 06:41:43 +0000, Richard Heathfield
<rjh@see.sig.invalid> wrote:

>Captain Tony Valare said:
>
>
>No, it makes no sense at all. Primes /are/ prime factors. They are not
>combinations of anything. That is practically the definition of primes!
>
>Exercise: here are the first ten primes: 2, 3, 5, 7, 11, 13, 17, 19, 23,
>29. List their prime factors.


Well, it may or may not make sense. It rather depends upon what
an epime number might be and what kind of combining is being
done.


Richard Harter, cri@tiac.net
http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate.
Captain Tony Valare

2008-03-27, 7:28 pm

I spent a 1/2 hour to find a line by Stephen Kochan of Bell Labs ,
Programming in C 1988 Hayden Books, "One method for generating prime numbers
involves an approach which uses the notion that a number is prime if it is
not evenly divisible by any other prime number. This stems from the fact
that any non-prime integer can be expressed as a multiple of prime factors.
(For example 20, has the prime factors 2, 2, and 5). The program algorithm
can test if a given integer is a prime by determining if it is evenly
divisible by any other previously generated prime. The term used
"previously generated" suggests that a recursive function is useful.

As a further optimization of the prime number generator program, it can be
demonstrated that any non-prime integer n, must have as one of its factors
an integer that is less then or equal to the square root of n.

So it is only necessary to determine if a given integer is prime by testing
it for even divisibility against all prime factors up to the square root of
the integer.
(but all those are infested by prime factors). So those primes can be
generated by using prime factors. It was not quite as straight forward as
you all believed. I ultimately could show what coincidence there was
between prime factors of the eventually generated primes. (what a nail
biter that was)>


"Richard Heathfield" <rjh@see.sig.invalid> wrote in message
news:3tadnbYxX94v3XbaRVnyvQA@bt.com...
> Captain Tony Valare said:
>
>
> No, it makes no sense at all. Primes /are/ prime factors. They are not
> combinations of anything. That is practically the definition of primes!
>
> Exercise: here are the first ten primes: 2, 3, 5, 7, 11, 13, 17, 19, 23,
> 29. List their prime factors.
>
> --
> Richard Heathfield <http://www.cpax.org.uk>
> Email: -http://www. +rjh@
> Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
> "Usenet is a strange place" - dmr 29 July 1999



Richard Heathfield

2008-03-27, 7:28 pm

[Top-posting fixed]

Captain Tony Valare said:
> "Richard Heathfield" <rjh@see.sig.invalid> wrote in message
> news:3tadnbYxX94v3XbaRVnyvQA@bt.com...
<snip>
[color=darkred]
> So it is only necessary to determine if a given integer is prime by
> testing it for even divisibility against all prime factors up to the
> square root of the integer.


Yes, but that doesn't mean that primes are a combination of prime factors
(which is what you actually said in your previous article).

> (but all those are infested by prime factors). So those primes can be
> generated by using prime factors.


Certainly true.

> It was not quite as straight forward as you all believed.


We're not mind readers. I replied to what you wrote, not to what you may
have meant to write.

> I ultimately could show what coincidence there was
> between prime factors of the eventually generated primes. (what a nail
> biter that was)


Yes, it must have been astounding to discover that every single prime had
the same number of prime factors... none whatsoever.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Captain Tony Valare

2008-03-27, 7:28 pm

Something that is related to the base number system makes all numbers prime
in base 2. since there are just 2 numbers, then all there are is the number
itself, or the number to the zero power. Any number to the zero power = 1.
Now to bring that idea forward, you could have a set of numbers which had
that property, but use a different base number system. Say base 13. Would
there be any prime numbers, well yes. And those primes would not have prime
factors, but logically they would not be ! (non primes). And in base 13,
all of the non primes can be derived from a set of prime factors. So if the
primes can not be derived from a set of prime factors and the non primes can
be, then the prime number which is the largest factor of all the previous
non primes, is the number we are saying has all of the non primes as
factors. Except that it is prime in this case and it has only itself to the
zero for a factor, and no other prime. In base 2..

> "Usenet is a strange place" - dmr 29 July 1999



Richard Heathfield

2008-03-27, 7:28 pm

Captain Tony Valare said:

> Something that is related to the base number system makes all numbers
> prime
> in base 2.


The primality or otherwise of members of Z does not depend on the textual
representation you choose.

> since there are just 2 numbers, then all there are is the
> number
> itself, or the number to the zero power.


You appear to be talking about modulus, rather than number bases.

> Any number to the zero power = 1. Now to bring that idea
> forward, you could have a set of numbers which had
> that property, but use a different base number system. Say base 13.
> Would there be any prime numbers, well yes.


Actually, assuming you mean mod 13, no, there wouldn't be any primes. As
Wolfram rightly says, "a prime number is a positive integer having exactly
one positive divisor other than 1", so 0 and 1 aren't prime by definition.
1 * 2 = 2 (mod 13) and 5 * 3 = 2 (mod 13), so 2 isn't prime. 2 * 2 = 4
(mod 13), so 4 isn't prime. 1 * 5 = 5 (mod 13) and 2 * 9 = 5 (mod 13), so
5 isn't prime. 2 * 3 = 6 (mod 13), so 6 isn't prime. 5 * 4 = 7 (mod 13),
so 7 isn't prime - and so on.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Captain Tony Valare

2008-03-27, 7:28 pm

You got me, since 1 is not a prime number. And I will be quoting you before
you will be quoting me.
Are you at all interested in the Karma of War.. My selection for this
evening would be:

Guns and Butter
http://kpfa.org/archives/index.php?arch=25483

GL (good luck horse racing)

"Richard Heathfield" <rjh@see.sig.invalid> wrote in message
news:xfmdnYqJzLocj3HanZ2dnUVZ8v-dnZ2d@bt.com...
> Captain Tony Valare said:
>
>
> The primality or otherwise of members of Z does not depend on the textual
> representation you choose.
>
>
> You appear to be talking about modulus, rather than number bases.
>
>
> Actually, assuming you mean mod 13, no, there wouldn't be any primes. As
> Wolfram rightly says, "a prime number is a positive integer having exactly
> one positive divisor other than 1", so 0 and 1 aren't prime by definition.
> 1 * 2 = 2 (mod 13) and 5 * 3 = 2 (mod 13), so 2 isn't prime. 2 * 2 = 4
> (mod 13), so 4 isn't prime. 1 * 5 = 5 (mod 13) and 2 * 9 = 5 (mod 13), so
> 5 isn't prime. 2 * 3 = 6 (mod 13), so 6 isn't prime. 5 * 4 = 7 (mod 13),
> so 7 isn't prime - and so on.
>
> <snip>
>
> --
> Richard Heathfield <http://www.cpax.org.uk>
> Email: -http://www. +rjh@
> Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
> "Usenet is a strange place" - dmr 29 July 1999



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com