[REBOL] Re: On mutability and sameness
From: joel:neely:fedex at: 19-Jun-2001 11:29
PMJI, but how about this explanation?
> I essence you are correct, but how easier can you more
> properly explain these examples.....
> >> a: "123" == "123"
> >> b: a == "123"
> >> c: "123" == "123"
> 'a & 'b are the "SAME" string! and refer to the same memory
> location. 'c has the same value on the surface but is a separate
> instance of a string! value and is stored at a separate memory
> That is why this....
> >> insert b "abc" == "123"
> >> b == "abc123"
> >> a == "abc123"
> >> c == "123"
> The value of 'A & 'B both change but 'C remains unaltered.
Excited by the brilliant future of REBOL, my wife and I move to
Ukiah. We open a joint account with our travel expense check of
$1,000. Similarly motivated, my unmarried son moves to Ukiah as
well, and opens an account with his travel expense check, also
At this point my son, my wife, and I would all reply to "What's
your balance?" by saying $1,000. Our balances are equal.
My son moves into an apartment, but my wife and I move into a
house with a yard. Therefore I drive to the store and by a
garden hose and sprinkler for $20, paying by check.
Now if you ask either me or my wife "What's your balance?" we'll
have to answer $980, while my son will answer the same question
by saying $1,000.
The difference is this: initially we had EQUAL? accounts, but
my wife and I have the SAME? account. Therefore, either of us
can write a check that affects our shared balance, but none of
those checks affects our son's balance, because his account is
not the SAME? as ours, even though it was originally EQUAL? to
> You can show this in 'C ( or some other language ) by use of
> pointers and references as Joel did.
You *can* show it using C (although I wish I hadn't ;-), but
it's not *necessary* to do so.
___ ___ ___
\/ 2 + \/ 2 = 4 (for sufficiently large approximations of \/ 2 )