Forwarded with the permission of Stephen Watt.

On 05/13/2008 05:30 PM, Stephen Watt wrote:
 > Hi Ralf,
 >
 > For does not introduce a new scope for its body for a few reasons:
 >
 > 1.  In languages like C any compound statement is a new scope so we
 >     have new scopes for loop bodies, branches of if-s etc.
 >
 >     This does not interact well with implicitly local variables.
 >
 >     If a new variable is by default local to the smallest enclosing
 >     scope, then new variables would be visible only in overly small
 >     regions.
 >
 >     E.g. suppose compound statements were scopes, then
 >
 >     if foo? then a := 1 else { f(); a := 2 }
 >
 >     would give unexpected results.
 >
 >
 > 2.  It is convenient to be able to test the last value that a for loop
 >     index reached.
 >
 > 3.  Since the language allows goto, it is useful to be able to reduce
 >     structured control flow to the goto case.
 >
 > I admit that none of these are absolutely compelling.  So I should add
 > that we tried it the other way, and this way made coding the library
 > easier.
 >
 > -- Stephen
 >
 >
 >
 >
 > On Tue, May 13, 2008 at 05:13:53PM +0200, Ralf Hemmecke wrote:
 >> Dear Stephen,
 >>
 >> could you give a comment about the background of "local" and "free"
 >> in Aldor and why "for" does *not* introduce a new scope for its body.
 >>
 >> Thank you
 >> Ralf


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to