Yep, the scoping rules and closure behavior are shamelessly stolen from
Scheme. Those guys seem to know what they're doing :-)
On Thu, Feb 5, 2015 at 12:08 PM, Michael Francis
wrote:
> thanks - so it take the scheme approach to closures. The let keyword
> allows the inverse.
>
> On Thursday, Feb
thanks - so it take the scheme approach to closures. The let keyword allows
the inverse.
On Thursday, February 5, 2015 at 10:36:37 AM UTC-5, Mauro wrote:
>
> Yes, this is expected. Have a look at the scope section of the manual,
> it also has examples on how to get the behaviour (I suspect) you
Yes, this is expected. Have a look at the scope section of the manual,
it also has examples on how to get the behaviour (I suspect) you want.
On Thu, 2015-02-05 at 16:26, Michael Francis wrote:
> function test()
> x = 2
> f = (()->x + 3)
> println( f() ) # Prints 5 Yeh!
> x = 4
>
function test()
x = 2
f = (()->x + 3)
println( f() ) # Prints 5 Yeh!
x = 4
println( f() ) # Prints 7 ???
g = (()->(x=4))
println( g() ) # Prints 4 Yeh, that should not be the same x
println( x ) # Oops seems it is the same X
println( f() ) # Yes seems t