Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Global function defined in context

From: al:bri:xtra at: 27-Dec-2002 8:35

Patrick wrote:
> 1. > > myWorld: context [ > set 'helloWorld func [][print "Hello World"] > ] > > 2. > > myWorld2: context [ > helloWorld2: func [][print "Hello second World"] > ]
3. myWorld3: context [ helloWorld: none set 'helloWorld func [][print "Hello World"] ]
>> probe myWorld3
make object! [ helloWorld: func [][print "Hello World"] ]
> Does 'set always create global function?
No. Evaluation of 'func creates a function! value. 'set takes the second value and assigns that value as the value of the first value (a word! value). Rebol looks for a matching word in the "closest" enclosing context. If none is found, Rebol creates a word in the global context. Andrew Martin ICQ: 26227169 http://valley.150m.com/