In experimenting with words in Rebol 3, I ran into the following error.
>> set to lit-word! "g" 4
** Script error: 'g word is not bound to a context
** Where: set
** Near: set to lit-word! "g" 4
This seems pretty tricky because of the following results:
>> to lit-word! "g"
== 'g
>> set 'g 4
== 4
I was wondering how a word cannot be bound to a context when it looks identical to the above...
In Rebol 3 there is certain behavior of the console and scripts that is important to understand:
Anything you type is
loaded by Rebol. When it isloaded, it is put in a context.If I type:
There is an existing word
bor'bwithout any of the code/data being evaluated, which is put in thesystem/contexts/usercontext, so it has binding to that context.And to show this is same context:
However, when you type
to-word "b", all thatloadsees is a wordto-wordand a string. So in this caseloadadds theto-wordword tosystem/contexts/userbut nothing happens with bindingbbecause it hasn't been loaded.Moreover,
to word!(orto lit-word!, etc.) when evaluated does not bind anything. That binding must be done manually.See How are words bound within a Rebol module? for more information