[REBOL] Words, Bindings and Contexts. (5)
From: lmecir:geocities at: 24-Jul-2000 15:09
In the part 4 I forgot to introduce a special kind of Contexts:
f) Dangerous Contexts. Example:
f: func [x] []
special-context? first first :f
CRASH
I obviously cannot claim that Same-context? works in this case.
Now I supply another interesting function:
; actually, Thomas Jensen was first there (nice work), but this
function is able to find even the Unset Words
context-words: func [
{returns all Context Words of a Word's Context}
word [word!]
/local result c-word
] [
either special-context? word [
; we are out of luck in this case
none
] [
result: copy []
foreach g-word first system/words [
if not same? g-word c-word: bind g-word word [
append result c-word
]
]
result
]
]
to be continued...