[REBOL] Re: Scope? Any advice would be appreciated.
From: lmecir:mbox:vol:cz at: 28-Jan-2001 15:55
I will try to explain the difference between the way Rebol works and you
expect it to
> lcDoesnt: func [ /local b ]
> b: [ 0 0 0 ]
> print "The following line should ALWAYS be: 0 0 0 "
> print b
> b/3: b/3 + 1
> print "The follwing line should ALWAYS be: 0 0 1 "
> print b
> print "......................."
> My expectations are the following:
> (1) the local variable "b" will be explicity set to [ 0 0 0 ]
Rebol: the local variable B will be set to the second value of the
> (2) the third element of "b" will be incremented by one, thus resulting
> [ 0 0 1 ]
Rebol: the third element of B will be incremented by one.
> (3) because "b" is declared local, it should not be accessable outside of
> the function
Rebol: the value is accessible as the second value of the LCDOESNT's body
> (4) "b" will be destroyed when the function exits
Rebol: no destruction