On Sun, May 11, 2008 at 8:46 AM, Gabriel Dos Reis wrote:
> Martin Rubey writes:
> |
> | (2)
> |         for i in 1..5 repeat
> |                 j: Integer := i^2
> |                 output(i::OutputForm)$OutputPackage
> |
> |         output(j::OutputForm)$OutputPackage
> |
> | (the scope of the variable j is restricted to the loop)
> |
> | ... I really like that (1) produces an error, but I really
> | dislike that (2) does, too...
>
> Why?
>

Perhaps it is not clear to Martin that "well-written" SPAD code should
look like this?

        j: Integer
        for i in 1..5 repeat
                j := i^2
                output(i::OutputForm)$OutputPackage
        output(j::OutputForm)$OutputPackage

with j defined in the scope where it is used. See:
http://axiom-wiki.newsynthesis.org/SandBoxLexicalScope

> |
> | Any chance of changing this?
> |

I think Gaby's change to require the definition to occur in the proper
scope is a good one.

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

Reply via email to