[REBOL] Re: Puzzle with FIND and SELECT
From: rotenca:telvia:it at: 10-Feb-2003 11:34
Hi, Ladislav
> I am not sure it is a "definition". How is that supposed to work? Would you
> like to have a function e.g. ABSOLUTELY-SAME?
I do not know. The problem is that rebol code does not give enough reflexive
information.
But i know that every rebol value is in a block at a given position. Beyond
its attributes, it has a block position.
Literal values, for example, have never the same block position:
same? "a" "a"
same? 1 1
should result both false.
Only if same? receive pointers to value the two values can be truly the same:
y: x: [[]]
same? x y
same? x/1 y/1
do reduce ['same? x x]
The actual implementations of same?, with some values, keep in consideration
memory storage, with other values ignore it. If i am not wrong, same? keep in
consideration memory storage only with mutable value and ignore it with
immutable value:
>> same? [] []
== false
>> same? 1 1
== true
So i think that same? gives the correct result only for mutable values. Your
version of same? does not exhibit a different behaviour, because function
arguments are pointers in case of mutable values and copies in case of
immutable values.
---
Ciao
Romano