[REBOL] Re: On mutability and sameness
From: lmecir:mbox:vol:cz at: 15-Jun-2001 1:49
> Let me guess... As a child, you always insisted on jumping in at
> the deep end of the pool, instead of wading in from the shallow end,
> right? ;-)
> Your post, as usual, inspired me to think of all sorts of interesting
> experiments and follow-on questions. To avoid boring everyone with
> most of my thoughts until I have baked them past the halfway point,
> I'll defer most of those rambling discussions. However, for the sake
> of clarification, let me raise a couple of them now.
> 1) A question: Given the transcript below:
> >> block-o-words: to-block "pie" == [pie]
> >> pie: "apple" == "apple"
> >> append block-o-words [pie] == [pie pie]
> >> do func [n /local pie] [
> [ pie: n
> [ append block-o-words [pie]
> [ ] 17 == [pie pie pie]
> >> get second block-o-words == "apple"
> >> get third block-o-words == 17
> >> print block-o-words
> ** Script Error: pie is not defined in this context
> ** Where: halt-view
> ** Near: pie pie pie
> would you say that BLOCK-O-WORDS contains three words whose names
> are all spelled the same, or would you say that BLOCK-O-WORDS
> contains three occurrences of a word with a different context
> attribute on each?
Mainly a terminological difference. I don't think, that e.g. RT could help
us with this. For me (trying to follow the Rebol behaviour if possible) the
words aren't the same. I would rather say, that BLOCK-O-WORDS contains three
words, whose "names" (or ROOT attributes, because they are attributes of
Rebol words) are equal.
> 2) You've done some interesting of "particle physics" yourself,
> as documented in the essays on your web site. I do feel
> compelled to make a distinction between inferences (however inspired
> or inspiring) about REBOL details versus clearly-documented features
> of REBOL.
clearly-documented features wouldn't have been discussed (or at least not
> You've inferred/postulated that WORD! values have attributes that
> could be called "type", "root", "context", and "stored value"
except for the fact, that the Special words don't have the "stored value"
> On the other hand, the REBOL documentation clearly states that (for
> example) TIME! values have HOUR, MINUTE, and SECOND components.
> REBOL provides explicit interfaces for accessing and (at least in
> my model ;-) modifying those components. They are, of course:
> access modification
> ------- ------------
> /hour /hour:
> /minute /minute:
> /second /second:
> With that said, I'm much more confident about making inferences and
> interpretations based on documented features than I am about basing
> inferences on top of other inferences.
Now I think I know what you are after. The central notion of your approach
is SHARABILITY, while the central notion of my description is MUTABILITY.
The interesting thing is, that there is a simple way how to translate
between them. Where is the difference?
My POV: According to Rebol, values can be the same. If the values are the
same for Rebol, they are the same for me, i.e. they are one value. If I use
this approach, I know, that Rebol values are sharable, because:
same? a b ; == true
Thus, all Rebol values are sharable for me ('a and 'b are sharing the same
time value). It is the Observation #1 in my
http://www.sweb.cz/LMecir/evaluation.html . If this is the case, then the
can't mutate the time value, because the value is shared and the mutation
isn't visible everywhere. This approach isn't in contradiction with any fact
you can find in the documentation. Neither it is in contradiction with the
behaviour of the SAME? function as described above.
Your POV: When I see the expression:
, I am not able to admit, that it may have been a replacement. (-:What about
the BM dialect bm [a/0: 1]? - that's what Ladislav would have said, oops, it
shouldn't have been here:-) Then I must say, that the observed change has
been a mutation. According to that, the time values aren't sharable,
otherwise we would have seen the mutation when we looked at 'b. This leads
to another conclusion: SAME? lies a bit, when it says we are sharing values.
We are not, we have copies sometimes. There is a problem: what does SAME?
Here's a little dictionary containing some basic notions:
Ladislav's notion <=> Joel's notion
(all Rebol values are sharable) <=> no translation, trivial notion
Changeable Attribute <=> Sharable Attribute
Mutable Value <=> Value With At Least One Sharable Attribute (Sharable
Immutable Value <=> Value With No Sharable Attribute (Non-sharable Value)
no definite translation <=> Mutable Value
no definite translation <=> Immutable Value
no definite translation <=> Mutation
no definite translation <=> Replacement
Now I can translate the main result on sameness contained in
http://www.sweb.cz//LMecir/evaluation.html to your dictionary:
Two equal values having equal types are the same (for the Rebol
interpreter), if they are Non-sharable, or if they share at least one
> 3) Since you interpret "stored value" as an attribute of a word,
> would you consider the following fragment as "changing an
> attribute of" the word?
a: 17 ; == 17
a: 42 ; == 42
I would like to explain it more extensively. I see a change. Some Rebol
properties are more understandable, if we are able to classify the changes.
Let's try to classify the above change:
The first point of view is, that I consider the integer value 17 as a
subject of the change. Then I can say, that the integer value 17 got
replaced by another value 42. Observed as a change of the integer value, the
above change is a replacement.
If I observe the same change as a change of the word 'a, I get to a
different conclusion. The word hasn't been replaced, it has been mutated.
Now the full classification: the observed change is a mutation of the word
'a, which changed (namely replaced) its stored value attribute, which was an
> ___ ___ ___
> \/ 2 + \/ 2 = 4 (for sufficiently large approximations of \/ 2 )