Hi Ladislav,

a note: the way you commentend on the last few messages makes it very
difficult (for me, maybe others) to identify what is part of the original
email being commented on and what is your comment (see below). It's also
difficult to detect where your comments begin. 

It would make it much more enjoyable and easier to read your email (again,
for me, perhaps for others), if your email client used a clearer way of
separating your comments from the text you are commenting on. Is that
something you can configure? Care to do that?

you wrote:
>Hi, Elan.
>
>You said:
>
>[Offending part deleted...]

I had not intention of offending anyone. Did I? I certainly apologize if I
did. 

You deleted quite alot of my email. That is perfectly ok. The deleted
paragraphs included the following statements, which, I was hoping, would
attract Joel's and other people's attention. I was hoping for a few
comments, perhaps from you:

I wrote:
>The words required to express the similarity 
>of features are word, value,
>datatype, reference, local, global, binding 
>and context. (Have I overlooked
>something?) The words necessary to distinguish 
>between the different
>constructs are indefinite extant, garbage 
>collection and literal. I believe
>that this is a pretty much comprehensive 
>list of the words required to
>describe the behavior of all of REBOL's language 
>constructs. Specifically,
>the similarities and differences between a 
>series, a hidden context, an
>object and a function can be expressed in 
>the terms presented in this list.

I don't think this particular paragraph should really be offensive to
anyone. It may be wrong, incomplete, ridiculous, but offensive? I had been
hoping to hear some opinions regarding what I said above.

I also wrote other things that I don't believe are all that offensive:

>In conclusion, a series is like a hidden context, 
>a function, or an object
>whose local word current-position-index has 
>been indefinitely extended by
>being referenced by a word, while its data 
>word is global like a literal
string. A series is different from a hidden 
>context, a function, or an
>object, in that the indefinitely extended 
>local word, current-position-index, is bound 
>to the context of the referencing word,
>'a, or 'b and so on, rather then being bound to 
>the series' context. Would
>the local word current-position-index remain 
>bound to the context of the
>series, the value of all words referencing 
>the series would always evaluate
>to that one value of the series' position index. 
>That is not how REBOL
>behaves. Each word may reference the series at 
>a different position,
>because the current-position-index is bound 
>in the word's context. And,
>again, in this respect, series are different 
>from functions, objects, and
>hidden contexts.

>I believe I have demonstrated that the 
>terminology I listed above, and
>which is commonly used in the REBOL 
>documentation, is sufficient to express
>what a series is. I have also demonstrated 
>that this terminology has the
>advantage that a series is described in terms that 
>reflect the similarity
>between different REBOL constructs, while it 
>allows us to specify how a
>series is distinct from the other constructs.

Care to comment?

Here are my comments. 
1. I was not talking about implementation. I only mean to say that the
behavior of a series can be described as something that
a) is a global data store and has a local current position index.
b) words such as next, back, head and tail modify the value of the current
position index.
c) because the current position index is local, it does not retain
modifications to its value from one evaluation to the next.
d) when a word is set as a reference to a series, the current position
index's context is extended AND the context of the binding of the current
position index to a value is bound to the word's context.

What point d) means in terms of how REBOL is implemented, I do not have a
clue. Whether REBOL's implementation actually changes the context of the
series' position index I don't know. But I think the terminology used
allows us to say something meaningful about series.

Point d) requires perhaps some explaining:

i. we usually speak of a context of a word. Whenever we speak of a word's
context, we are speaking of a defined environment, in which there exists a
group of words, such that each word is BOUND to a specific value.
Therefore, when we speak of a word's context we are speaking of bindings
between words and values. 

For instance, here current-position is being bound to two values in two
contexts:

>> first-context: use [current-position] [current-position: 1
'current-position]
== current-position

>> second-context: use [current-position] [current-position: 2
'current-position]
== current-position

Both bindings continue to be valid simultaneously, in these different
contexts:

>> get bind 'current-position first-context
== 1
>> get bind 'current-position second-context
== 2

ii. we don't usually speak of a binding (i.e. an association between a word
and a value) being bound TO a context. We usually speak of a word being
bound IN a context.
But since we can reference a context with a word and that word is bound
within in a context, we can speak of the context referenced by a word as
being bound to the word within the context associated with the word.

context-1: use [b] [b: 1 'b]
context-2: use [b] [ b: context-1 'b]

So, now context-1 is bound to 'b in context-2:

>> get get bind 'b context-2
== 1

I believe that point d) satisfies the following constraints: 

1. Different words can reference one and the same series.
2. Series have a current position index.
3. Words do not have anything other than a reference to a value.
Specifically, they for sure don't have a current position index.
4. When a word is used to reference a series, the series continues to be
referenced at the position its position index was set to at the time the
word was assigned as a reference to it. That needs to be explained.

That the current position index is local to the series formulates that
modifications to the position index are not permanent. When a word
references a series, it extends context of current position index. That is
consistent with indefinite extend. 

When a series is referenced by a word, it is embedded in a series, then the
context of its current position index is extended, which is always true for
local words:

>> series-func: func [value /local current-position] [
[    current-position: value
[    'current-position
[    ]
>> a: series-func 3
== current-position
>> a
== current-position
>> get :a
== 3

However, indefinite extend does not maintain the binding of a word to the
value it referenced at the time its context was extended. When the current
position index of the series is modified by evaluating b: next a, for
instance, then a's current position index should be bound to the same value
as b's. In our example function, the following happens:

>> b: series-func 2
== current-position
>> get :a
== 2

Because the value current-position is bound to was changed, a's
current-position reports the new value, 2. This is not how series work.
Series are different from functions in this respect. In series, not only is
the context of current-position extended, the extended local word's binding
to a specific value is extended as well. 

I believe we can account for this behavior, by not stating that a series
current-position index's context is extended, but rather by saying that the
current-position index's binding to a value is extended. 

Or: the context in which 'cursor-position is bound to a specific value,
that context is bound to the word cursor-position in the context of the
word referencing the series at that position.

We can therefore stay within the vocabulary commonly used to describe the
behavior of REBOL constructs, local, global, binding, context, word, value
and yet describe the unique feature of a series, that permits multiple
words to reference the same series at different positions.



You wrote:
>a: "1234"
>b: next a
>c: next b
>
>a, b and c reference the same series at different positions.
>
>[This, although wrong (?!) can be proven as follows:]

1. Is the part in brackets your comment on my quote? I'm sure I didn't
write "[This, although wrong (?!) can be proven as follows:]". I'm assuming
its your comment. (Correct me if I'm wrong.)

I do have problems understanding what the sentence in brackets is supposed
to mean: 

>...although wrong (?!)

1. Are you saying that a, b and c do not reference a value?
2. Are you saying that the value a, b and c reference is not a series?
3. Or are you saying that they do not reference the series at different
positions?
4. Or are you saying that a, b and c do not reference the same series? 
5. Are you saying that it was NOT Joel's intention to find a term that
expresses that a, b and c reference the same series at different positions
and I'm wrong in assuming that he did?

Do a, b and c reference a value?

>> a: "1234"
== "1234"
>> b: next a
== "234"
>> c: next b
== "34"

Now they do.

Different Positions?

>> index? a
== 1
>> index? b
== 2
>> index? c
== 3

Clearly, different positions.

Is the value referenced by a, b and c a series value?

>> series? "1234"
== true
>> series? a
== true
>> series? b
== true
>> series? c
== true

The words, a, b and c reference the string "1234". REBOL apparently
believes that the string "1234" is a series. Therefore REBOL believes that
the value reference by a, b and c is a series.

Same series? 
Since the positions are different, same? will notice that and declare the
value's referenced by a, b and c to be different. So, we have to make sure
that the position index of the value referenced by a, b, and c are is to
the same value, by using head.

When we use head with same? (same? head ...) same? will only return false
if something in addition to the position indexes is different. I'll use
head in order to force the position index to the beginning of the series.
Then same? will return false, if the words a, b and c are referencing
different values.

>> same? head a head b
== true
>> same? head b head c
== true

So, the position indexes are different as demonstrated by the function
index?. Nothing else besides the indexes is different as demonstrated by
same? head x y. 

Perhaps same? looked at three different series, but because the data they
contained was the same, it got confused and thought they are one and the
same series?:

>> x: "1234"
== "1234"
>> y: "1234"
== "1234"
>> same? x y
== false

Same data, different strings, same? doesn't get confused, it returns false.
Quite clearly, when same? returns true, we are talking about one thing, and
one and same thing only. 

So, the value referenced by a, b, and c:

1. Is a series value. (series?)
2. The words reference the series at different positions. (index?)
3. Besides the position index, it is the same value (same? head ...) and
not three different series values that just happen to be storing the same
data.

So, the words were assigned as references to the string, which is one
example of a series. The words aren't the series. The value they are
referencing is the series. And - to make sure everyone understands I'll
repeat myself - the series being reference by a, b and c is the same
series. the words a, b and c reference the same series, BUT at diffent
positions. This formulation is fully consistent with what REBOL reports
about a, b and c.

Since the statement you apparently disagreed with was:

"a, b and c reference the same series at different positions."

and - as demonstrated above - they indeed do, you must mean that Joel did
not intend to define a term that would express that "a, b and c reference
the same series at different positions." I'm pretty sure that was what he
was doing. 

Unfortunately, in your email, you never reveal what in your opinion was
Joel's undertaking. What do you think that Joel set out to do, when he
redefined series? 

>
>a: "1234"
>b: next a
>c: next b
>
>reference: func [x [series!]] [
>    head x
>]
>
>same? reference a reference b
>same? reference a reference c
>same? reference b reference c
>
>position: func [x [series!]] [
>    index? x
>]

These functions were not part of my email. There is no way for the reader
to identify them as part of your response to my email. That is confusing,
don't you think?

>
>[Funny, isn't it?]

Again, I'm assuming that the thing in brackets is your comment. I didn't
put it there. The reference and position functions - I believe - are also
your contribution. (I didn't write them). They are not contained in
brackete and therefore one could think that they are part of the email you
are responding to. That's confusing. Your comments (including functions you
contribute) should be clearly distinguished from the email you are
commenting on. It would make life much easier for people, who are following
the thread and who couldn't determine whether the functions were your
contribution or whether they were part of my email message you are
commenting on. 

As for your comment, "Funny, isn't it?" No. It's not funny. It's obvious.

>[Interesting. You are saying: Murphy is not a man, it's only a word, but I
>was warned that Murphy didn't invent The Murphy's law, because it was
>invented by somebody that (accidentally) had the same name only...]

That's funny. (No, it's not offending. It IS funny.)

No, that is not what I am saying. 

Unlike Murphy, the REBOL word 'a is not a name of anything. You're
stretching the metphor (a word is a reference to a value, that is like
someone has a name) to the point, where the metaphor no longer works like
the relationship between words and values does.


Hope This Helps,

Elan

Reply via email to