On Sun, May 11, 2008 at 12:47 PM, Martin Rubey wrote: > > ... Moreover, what should > > j: Integer := 0 > for i in 1..5 repeat > j: Integer := i^2 > output(j::OutputForm)$OutputPackage > > output?
I would expect 0. > It would be different from > > j: Integer := 0 > for i in 1..5 repeat > j := i^2 > output(j::OutputForm)$OutputPackage > Yes. > but I think the intention is unclear when these semantics > are used. > I think the intention is clear in languages that follow nested lexical (static) scoping rules. http://c2.com/cgi/wiki?LexicalScoping http://en.wikipedia.org/wiki/Scope_(programming) I suppose the question is whether it is "natural" that 'for' and other ways for forming program blocks should establish a new lexical scope. This is common in other languages, so I think "yes". But perhaps you already noticed that this is *not* the case in Aldor (**): http://www.aldor.org/docs/aldorug.pdf#page=115 "New scopes in Aldor are introduced by the following expressions: - E where Definitions - +-> - with - add - for i in ... - Applications, e.g. Record(i: Integer == 12) These forms may be nested to any depth. Note that the last two bind names in particular positions in the expression, and **do not form general scope levels**. Lexical scoping implies that the only variables visible at a given point in a program are those that have been created locally or imported into scopes surrounding the current point." Regards, Bill Page. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel