1. Re: goto / global variables
On 28 Sep 97 , Robert Craig wrote:
> Daniel Berstein writes:
> > --This is file MODULE.E
> > static myvar
> > global function read_myvar()
> > return myvar
> > end function
> > global procedure write_myvar(atom value)
> > myvar = value
> > end procedure
> > -- End file
> >
> > -- This is file PROGRAM.EX
> > atom test_value
> > write_myvar(100) --Now myvar holds the value '100'
> > test_value = read_myvar() --test_value
> > write_myvar(test_value*2) --Nowmyvar holds value '200'
> > myvar = 100 --Error! you can't reach myvar directly
> > --End file
>
> Your proposed "static" keyword is unnecessary because
> "static" is the *default* in Euphoria. All symbols are "static"
> unless they are declared with "global" in front of their declaration.
> For a symbol to be accessible from another file you *must*
> declare it as "global".
Colin Taylor also notice this... Emmm... I'm sorry, I should have
tested this first. Anyways this is a great news!!!! I didn't thought
Euphoria was so brilliantly concieved! (Thanks again Rob).
Regards,
Daniel Berstein
danielberstein at usa.net
http://www.geocities.com/SiliconValley/Heights/9316