Hi Jerry,

I attempted to try your example, but I ran into a glitch:

>> block: copy [] repeat i 4 [use [x] [x: i * i append block 'x]]
== [x x x x]
>> do x/1
** Script Error: x has no value.
** Where: do x/1

Perhaps you meant:

>> do block/1

If you did mean do block/1 and do block/2 etc.

then I don't think you have found a bug. What you observe makes perfectly
sense.

When you say:

do block/1 you are asking REBOL to evaluate that thing it finds at block/1.
That thing is the word 'x. When x is evaluated, it retrieves the value it
was bound to. In you repeat loop four contexts were created and in each
context there exists a word 'x which is bound to a different value.

When you say

>> block/1 = block/2 

you are asking whether whatever is found at position 1 of the block is
equal to whatever is found at position 2 of the block. What is found at
position 1 of the block is the word x, which is not being evaluated:
>> block/1
== x

What you find at position 2 of the block is also 'x before it is evaluated:
>> block/2
== x

So, what REBOL is saying that the unevaluated, literal word 'x is the same
thing as an unevaluated, literal word 'x. Since 'x has not been evaluated,
the 'x itself here is being treated as the value.

If you say:
>> same? block/1 block/2
== false

REBOL returns false, because now REBOL is not only comparing the values 'x
and 'x but it is also checking if these two 'x are identical. Compare to
REBOL's behavior here:

>> = [] []
== true
>> same? [][]
== false

Hope this helps,

Elan >> [: - )]


you are asking whether the path block/1 references the same thing as the 

At 06:34 PM 12/28/99 -0500, you wrote:
>Gabriele,
>
>I think, using your example, that I have found a bug in REBOL.
>>> block: copy [] repeat i 4 [use [x] [x: i * i append block 'x]]
>== [x x x x]
>>> do x/1
>== 1
>>> do x/2
>== 4
>>> x/1 = x/2
>== true
>>> x/1 == x/2
>== true
>>>
>What do you think? Is it a bug?
>
>Jerry
>
>
>

Reply via email to