[REBOL] Re: Context - code included- 2nd version
From: rotenca:telvia:it at: 14-Sep-2001 18:46
> Lots of comments:
>
> you don't have to agree or understand. I am sorry if I made you think
> otherwise.
No, no. Don't worry! I know.
...
> > Tell me how you can explain the word "any". When a word is in a context,
> only
> > that context can give a definition to the word, so why to speak of "any"
> > others contexts?
>
> The above formulation isn't mine. What I see is, that it looks very
> confusing. A code sample:
It is from Core. Your explanation: "is confusing". It seems to me that when
something is againts your ideas, "it is confusing" ;-)
> spc: first to block! "rebol"
> error? get/any spc
> ** Script Error: rebol is not defined in this context
> ** Where: halt-view
> ** Near: error? get/any spc
>
> If you don't tell me, what does the "any" mean in this case, I don't know.
Too many parts of Rebol doc is confusing or meaningless for you.
Can be true, but is seems strange to me.
> > 2) "A variable refers to a specific value only within a defined context,"
> > So when it doesn't "refers to a specific value" (=get fails
> SpecialWord) it
> > is not "within a defined context"
> I show you another example of the same reasoning:
>
> "I am sleeping only if I am in my bed." - true, at least for me
>
> So when I am not "sleeping" I am not "in my bed" - false 8^)
You read it as a->b, but i read it as a<->b, so: not a -> not b.
In this context, i think that the right interpretation is mine, your is
possible. If we get yours, we have:
a->b
not a
= b undefined
i.e
if a word doesn't refers to a value we can not know if it is "within" a
context (or its context is undefined).
But you say that we can know, just failing to to get the value of word, the
context of a words:
special? : error? try [error? get/any :word]
Obviously, one of two is incorrect.
> ...snip...
> > 4) "The scope of a variable is determined when its context is defined."
>
> > Ergo: context of a word can be undefined.
>
> No, wrong reasoning again:
>
> "Zero is equal to zero when one is equal to one."
If you use "when" in the usual sense (i must see the context) and i have
reason to trust you, i must think that you think that "one is not always equal
to one". It is not true for me, but it seems that you think that. I can't
exclude this only because i've a different idea. I can't think that you speak
confusingly all the time you do not express my same convintions. It seems that
you think that it is POSSIBLE that one it is not one.
At least one statement of doc affirms that a word is "not defined within any
context" so i have understand that "when"
in the right sense.
...
> The above sentence I read as: "a block can be a context" or "a function can
> be a context" or "an entire program can be a context". Highly confusing.
Not so clear. But read it in the Context! :-)
> > context. Outside a context the word can have a value if is defined in
> another
> > context, or it can have no value and in this case is "not defined within
> any
> > context".
>
> Incorrect.
I forget Mecir Contexts :-)
> > So my functions could become (restricting the use of word "symbol"):
> >
> > variable?: binded? ...
> > symbol?: not binded? ...
>
> I am sure that you either haven't understood the text or that the text has
> confused you. The meaning of it is, that you have got two ways how you can
> use any word:
>
> 1) use it as a symbol
> 2) use it as a variable
No, i'm not confused:
you can not succesfully use a word as variable if, for that word, the function
symbols? return TRUE:
Proof:
> spc: first to block! "rebol"
>symbol? spc
==true
> error? get/any spc
> ** Script Error: rebol is not defined in this context
> ** Where: halt-view
> ** Near: error? get/any spc
What i want to say:
1) variable?: binded? : this word can be used BOTH as variable and as symbol
2) symbol?: not binded? not variable?: this word can't be used as variable
(without trasforming it in a variable with binding) but it can be used as a
symbol.
Beyond all, i think that your observation #9 is the problem.
You should say: bind has a bug.
AUT Mecir Context <> Rebol Context AUT bind has a bug (XOR :-)).
You do not say that bind as a bug, ergo...
Changing argument: there a reason for which bind doesn't bind to get-words and
set-words? Sometime we have of context only that type of word, and i do not
know a method to trasfom them in word! preserving binding.
To end here it is some very little suggestions for your s-c? (argument and
reading):
same-context?: func [
{
find out, if the given Words
are bound to the same Context
}
word1 [word!]
word2 [any-word!] ;<<<<<<
] [
found? any [
all [
special? word1
special? word2
]
all [
not special? word1
same? word2 first bind to-block mold word2 word1 ;<<<<<<
]
]
]
I hope it is correct.
---
Ciao
Romano