[REBOL] Re: [Newbie]: Problems with lit-words
From: gabriele:colellachiara at: 27-Oct-2005 11:54
On Thursday, October 27, 2005, 11:34:24 AM, you wrote:
SB> Now if I do this:
>>> set a ""
SB> == ""
SB> Why if I make this:
SB> == b
SB> == ""
SB> I've this results? Why b got the value set for a? And a is still b?
Let me try with an example.
>> my-set: func [word value] [?? word ?? value]
>> a: 'b
>> my-set a ""
>> my-set 'a ""
As you can see, the actual arguments you are passing to SET are B
and "", so it sets B to "". SET does not even see A; that's
because arguments are evaluated, and A's value is B. If you want
to pass A, instead of the value of A, you need to use 'A.
This is the same thing that happens when you write something like:
>> my-set 'a 1 + 1
The function does not see "1 + 1", it gets the result of
evaluating "1 + 1"; in the same way, you don't get A above, but
the result of evaluating A, which is B.
Hope this makes things a little bit clearer...
Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/
Colella Chiara software division --- http://www.colellachiara.com/