[REBOL] Re: Binding
From: carl:s:rebol at: 19-Nov-2002 16:06
Good discussion. Wish I had more time to hang out and read...
At 11:02 PM 11/19/02 +0100, you wrote:
>I think I now know why: Because the words carry the context around, you
>don't have a single place where you enter a specific context and leave
>it (namespeace analogy). Instead you have a set of words with a lot of
>different contexts, which are used in the actual block.
Exactly. It has to be that way. Here's an example of why:
print-block: func [block] [
foreach value reduce block [
print value
]
]
example: has [temp][
temp: 12
print-block [temp now]
]
The contexts of TEMP and NOW have to be carried with them, otherwise they can
not be known within the print-block. This is that "variation" on static
(syntactic)
binding that REBOL uses. It's not precisely static, because it can be modified
at runtime by functions like BIND, MAKE, FUNC, etc.
BTW, named contexts *are* created by MAKE OBJECT... what you want is a way to
pass them as an argument to BIND (rather than a word from the object). An
interesting
(and doable) idea.
-Carl
Carl Sassenrath
Founder & Chairman
REBOL Technologies
www.rebol.com