[REBOL] Re: Q: Functions and the visibility of words
From: rgombert:essentiel at: 25-Apr-2001 12:14
You can use local words by asking for it (cf example at the bottom) with
/local un the argument block or with a USE inside the body... so it's
possible to avoid side effects.
The way a language treat "locality" is just a choice. In PHP, variables are
all locals to function... unless you ask them to be "global". In rebol it's
the opposite. It should't be a problem since we know the way it work. It's
certainly less difficult to understand for the begginer than the
(any-blocks) words vs standard variables behavior.
Renaud
>> a: func [a /local b][z: b: a]
>>
>> a 1.618
== 1.618
>>
>> z
== 1.618
>>
>> b
** Script Error: b has no value
** Near: b
>>
>> a
** Script Error: a is missing its a argument
** Near: a