[REBOL] Contexts was: Special word
From: lmecir::mbox::vol::cz at: 8-Sep-2001 3:17
Hi, Rebols!
Summary: Romano discovered an interesting "feature": the System/words object
isn't the Global Context! Contexts.html
http://www.sweb.cz/LMecir/contexts.html ) needs a revision!
Romano:
> Now i want "stress" you with another question, about your "Special Word"
> concept.
>
> I make a word:
>
> >> word? first to-block "foo"
> == true
>
> The function Special return true for:
>
> Special? first to-block "foo"
> == true
>
> "foo" is not in system/words:
>
> find first system/words first to-block "foo"
> ==none
Amazing! You revealed, that there are words that cannot be found in (first
system/words). That invalidates some parts of Contexts.html:
1) The first one is the statement, that the System/words object is the
Global Context. If I define the Global Context as the collection of all
Global words, than I get:
global?: func [
{find out, if the given Word is a Global Word}
word [word!]
] [
same? word bind word 'system
]
gw: bind first to-block "foo" 'system
global? gw ; == true
find first system/words gw ; == none
It is immediately obvious, that the System/words object is only a part of
the Global Context!
2) The second victim is the Visualize-context function as you pointed out,
because it can find only the words from System/words.
>Another case:
o: context to-block "foo2: 3"
find first system/words first to-block "foo2" ; == none
find first o first to-block "foo2" ; == [foo2]
> Now: "foo2" is in the context "o" but not in the Global context.
Not exactly, you can find the corresponding Global word as above, but not in
the System/words object!
> Romano
Excellent work Romano!
Ladislav