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

[REBOL] context of a function Re:(5)

From: rebol:techscribe at: 22-Aug-2000 0:06

Hi Brian, Indeed it is. I didn't investigate that throughly enough. The implementation is not exactly consistent with its intended use. I wonder whether that's a good thing ... guess it's not likely to cause any harm. With respect to the function context binding I think it makes sense to skip /local. That is consistent with the intended use of /local.
>>With exception of /local all of these words are bound to the function's >>context, as soon as the function is constructed. >> >> >> fblock: foreach word first :f [ >> if word <> /local [ >> append [] to word! word >> ] >>] >>== [a ref b] > >Actually, the word local is bound to the function as well. >/local is just another refinement - it's just treated in a >special way by the help function. >The evaluator doesn't >treat it in a special way. You can preset locals like this: > > >> f: func [a /local b] [add a any [b 1]] > >> f/local 1 3 >== 4 > >I don't know about you, but I found this quite amusing. All >those earnest REBOL programmers thinking /local is special, >when it's really just a quick, elegant hack. > >I love this language :-) > >Brian Hawley >
;- Elan [ : - ) ] author of REBOL: THE OFFICIAL GUIDE REBOL Press: The Official Source for REBOL Books visit me at