[REBOL] Re: Context - code included- 2nd version
From: holger:rebol at: 13-Sep-2001 14:33
On Thu, Sep 13, 2001 at 10:29:49PM +0200, Ladislav Mecir wrote:
> Would you like to change it to: "...words represent values...", "values are
> represented by words..." [RCUG 2.3 p. 3-13], or something different?
Neither, actually, because both wordings imply a static reference, which does
not exist.
You have to distinguish between explanations intended for beginners, and
explanations that are suitable for the kind of technical discussion we are
having. For instance the User's Guide also refers to "variables", even though
there is no such thing in REBOL. REBOL does not have variables as a concept
by itself, but variables in other languages are really just dynamic name-value
mappings, and you can get a similar effect in REBOL by binding a word into a
context and 'set'ting a value for it in that context. You should not take all
explanations too literally, in particular not if explanations are intended to
explain complex concepts in easy terms.
There is also the problem that the word "word" is not always used consistently.
What does the word 'word' mean ?
Hi, Bill :). Sometimes people use "word" when
they just refer to a spelling, other times when they refer to a particular value
of the type word! inside of some block series. In the former case the "word" does
not represent a value, in the latter it might, indirectly, if you want to look at
it that way. It is still a somewhat unnatural point of view though, somewhat like
claiming that a function "represents a value" when it really "returns a value".
> > - There is no "Special Context" and there are no "Special Words". What you
> call
> > a "Special Word" is in reality a word not bound into a context.
>
> You are contradicting yourself above, aren't you? In the first sentence you
> are telling that there are no "Special Words" and in the second one you are
> telling, that you call them "words not bound into a context".
You can always make up some arbitrary definition. By "there is no" I mean
that your definition is neither necessary nor, IMHO, useful. You might
just as well define the class of all "Cool Words" to be words that start
with the letter "c". I would claim "there are no Cool Words", and you would
come back claiming "I can create words starting with the letter 'c', so there
are 'Cool Words'". This is not getting us anywhere.
> As to whether the "Special Context" exists: here you are making the same
> mistake. Because you admit that the words ("words not bound into a context")
> exist, the collection of such words exists too.
Yes, and the "Cool Context" is the context of all "Special Words" starting
with the letter "c" ??? The "Special Context" is an arbitrary definition not
backed up by observation or implementation.
Plus, in this specific instance, your definition is not just redundant, but
actually conflicting, because a context is, by definition, a name-value
mapping, and unbound words do not (and CANNOT) have any value, so they cannot
belong to any context. Introducing a "Special Context" with different rules
than all other contexts (word without values) just so you can call it a
context
is Very Bad Science.
> The only point you can make
> is, that the collection specified is not a context. But, that is again a big
> trouble, because I found out, that every "word not bound to any context" is
> actually bound to the Special Context (to translate it to your terminology:
> has got a reference, that is the same as the reference that any other "word
> not bound to any context" has).
No, it is not bound anywhere. That's why you cannot assign a value to it.
'set on an unbound word results in an error.
I don't know what you mean by "has a reference". If a word is bound into a
context then that word references the context (indefinite extent), and the
name-value table of the corresponding context lists the spelling of that word
in its "name" column. An unbound word does not reference any context, and no
context necessarily lists the spelling of that word.
> > The facts are: words live inside of blocks.
>
> I would add: not always. In Rebol it is possible to create words that don't
> "live inside of blocks".
If you want to be really precise then replace "block" with "block series":
every single word in REBOL, without exception, exists inside of a block series.
Always.
> > When a block is created all words
> > in it are either bound into a context, or remain unbound. Certain
> functions
> > ('use etc.) change the binding of words. That is all there is to it, and
> the
> > "scope" of a word at any given time is simply determined by the last
> bind
> > operation on it before the word gets evaluated.
>
> This is correct but misleading, if you don't define the notion of "the last
> bind operation" and what you mean by scope.
last
in a temporal sense, "scope" in its usual meaning.
--
Holger Kruse
[holger--rebol--com]