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
load
ed by Rebol. When it isload
ed, it is put in a context.If I type:
There is an existing word
b
or'b
without any of the code/data being evaluated, which is put in thesystem/contexts/user
context, so it has binding to that context.And to show this is same context:
However, when you type
to-word "b"
, all thatload
sees is a wordto-word
and a string. So in this caseload
adds theto-word
word tosystem/contexts/user
but nothing happens with bindingb
because 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