[REBOL] Re: On mutability and sameness
From: robbo1mark:aol at: 19-Jun-2001 11:34
JEFF,
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 location.
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. You can show this in 'C (
or some other language ) by use of pointers and references as Joel
did.
Similarly....
>> a: <abc>
== <abc>
>> parse a [b:]
== false
>> b
== "123"
How do you explain that unless you drop down to C or
something else and show your any-string! or any-block!
models with pointers to memory storage for the actual "data" values.
In the above example both reference the "Same" string!
data but 'a has the datatype! value tag! whilst 'b is
a normal string! datatype!
Sometimes to understand what's in a forest and what makes a forest you've got to look
at trees and leaves
and leaf / tree cells. Afterall thats how you really
UNDERSTAND trees & forests, even if it is from the
bottom up.
Also what is wrong with helping your neighbour to paint
his fence is you neighbour is your friend?
Depends who has more REBOL spirit, Huckleberry Finn
or Aunt Polly?
cheers Jeff 8-)
Mark Dickson
In a message dated Tue, 19 Jun 2001 11:01:20 AM Eastern Daylight Time, Jeff Kreis <[jeff--rebol--net]>
writes:
<<
[Robbo1Mark--aol--com]:
>> .... Having followed this thread with interest, I believe,
barring the disclaimer above, that both Joel & Ladislav are
WRONG in the sense that some REBOL behaviour can only be
explained and understood fully in terms of the way it has
been implemented.<<
That's a very bottom up way to think of things. When we
implement parts of REBOL we first sit down and say "how is
this supposed to work-- what are the rules it obeys." Once we
understand what something is supposed to do, then we write the
lower level code that does that thing we've figured out. It's
a process of describing in a low level, something you
understand at a high level. You're claiming to want to
understand something at a high level by considering how it is
expressed at a low level. That's like trying to understand
what an Elephant IS by looking at one of its cells under a
microscope. How do you even know what you're looking at is an
Elephant?
The way functionality is implemented is arbitrary as long as
it is reasonably space and cpu efficient and the
implementation behaves according to the high level
functionality that's desired. Joel's got this one on the head.
You gain little understanding of something like series by
trying to build series in C. You'll miss the forest for the
trees, so to speak.
Robbo:
>>To fully understand the behviour of any-block! or
any-string! series! values you have to have a model of how
series! values are implemented at the C code level from
which REBOL is built. ... Whilst any C code model we might
build for REBOL values... will most probably NOT exactly
match the RT official implementation, I think it is important
conceptually that we do TRY to conceptually build an
implementation model.<<
Joel:
>> C may be OK for giving examples, but it is certainly not
the only way to think about computing, IMHO.<<
Yes, but I think Mark's interest in having things
"explained" in terms of C code has less to do with
"understanding REBOL" at a high level, and more to do with
having people help "paint his fence", if you've ever read
Tom Sawyer. ;-)
-jeff