[REBOL] Re: localized func alternative...
From: brett:codeconscious at: 28-Feb-2004 15:39
Ammon wrote:
> The best way to achieve this (IMHO) is to simply use CONTEXT. This sets
> everything within an object and you can set global words using SET. A
note
> about setting words this way though, they have the context of the CONTEXT
> they are set in so while they are global, their values are relative to the
> context.
Just a clarifcation for REBOL learners.
Set used this way normally does set global words but only because the word
you give to Set is global in the first place. Give Set a word from another
context (a non-global context) and it will happily set that word in that
context - Set is not limited to global words. For example:
ctx-1: context [
word-one: 1
ctx-2: context [
word-two: 2
set 'word-one "one"
]
]
>> print ctx-1/word-one
one
Regards,
Brett