[REBOL] Re: Object of confusion
From: gabriele::colellachiara::com at: 7-Sep-2004 11:23
Hi Sunanda,
On Tuesday, September 7, 2004, 1:42:11 AM, you wrote:
Sac> It confused me. (I'll leave it to the experts to explain what's going on)
The answer here is pretty simple.
>> a: make object! [b: 0]
>> c: make a []
>> same? a c
== false
So far, so good, right? C is a clone of A, but they are not the
same value.
Indeed:
>> a/b: 1
== 1
>> a/b
== 1
>> c/b
== 0
They are not the same, so changing one does not change the other.
But now if we do:
>> a/b: a
>> c/b: a
>> same? a c
== false
>> same? a/b c/b
== true
we see of course that A and C are still different values, but A/B
and C/B are the same value, because we set them to the same value
(A).
This accounts for the differences in molding A and C:
>> probe a
make object! [
b:
make object! [...]
]
>> probe c
make object! [
b:
make object! [
b:
make object! [...]
]
]
indeed, while A/B refers to A, C/B does not refer to C, but to A.
(See above, this is how we set them.) We can represent them as:
A ---> [ B ---+ ]
^------+
C ---> [ B ---> [ B ---+ ] ]
^------+
which accounts for the result of MOLD.
HTH,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/