[REBOL] Re: Context - code included- 2nd version
From: rotenca::telvia::it at: 11-Sep-2001 23:05
> Hi,
Hi, Ladislav
> > > > do (all but block)
> > >
> > > I don't think the last one is correct...
> >
> > Sure?
>
> Probably you should explain what you meant by "do (all but block)", I am not
> sure I understood you.
Here it is:
>> do to-block "aaasdas"
** Script Error: aaasdas is not defined in this context
** Near: aaasdas
>> in system/words first to-block "aaasdas"
== none
so "do block" do not load word, but "do %file" "do url" load them.
RT Documentation says:
"Accepts a block, or LOADs a string, file, or URL into
a block, then evaluates the expressions of the block."
> to
> make
Depends by datatype (block! do not load )
> > My interpretation:
> > in the actual context (global+locals) the word is not binded (defined).
> >
> > Es.
>
> Aha, so you are trying to define a notion of Actual Context to help you to
> explain this situation. The problem with your explanation is, that the
> situation in your description looks like being caused by the fact the Word
> is not "defined" in the Actual Context. Even though I don't know your
> definition of the Actual Context, I am pretty sure, that it should be an
> extensible collection of Rebol Words, if it contains the Global Context,
> which is an extensible collection of Rebol Words itself. It provokes a
> thought that after an extension of the Actual Context the situation of the
> Word may change because after such an extension the amount of the "defined"
> Words must increase.
>
> But, alas, the opposite is true: no extension of anything can cause the Word
> to become "defined", because it will always remain the Special Word being a
> Special Word once. (Special Words are immutable Rebol values according to my
> findings!) That is why I prefer my explanation.
I want to say that if the binding has been different ("this context" was
different) the word could be defined. If you ask its value after the binding
of word, you'll get a value, because "this context" (global+local) will be
different.
You prefer your interpretation, i think, because you want to keep your
definition of context like a simple collection.
I have the impression you don't like the concept of Context at all. You speak
of bind (16.) after the definition of almost everything (global, local,
special - context as collection) as if binding was a secondary propriety of
Context (and you say very little of bind function in 16.). For me Context is
not understandable well without the notion of binding.
Indeed, your definition of collection (11.) depends from the notion of
bindings:
Rebol Contexts can be defined as some collections of Rebol Words. I define a
function, that can find out, if two given Words are bound to the same
Context:
^^^^^^
same-context?: func [
...
not special? word2
same? word1 bind use word1 reduce ['first reduce [word1] ]
word2
^^^^^
As i have already said: your same-context function is not correct: it can only
prove that every Special Word is not binded to other words, so if you want
speak of collections, you must say that it is a collection with one item (like
the Zero?). You should say:
Every single Special Word is a Special Context.
Every Special Context is a collection of only one word.
There are as many Special Contexts as Special Words.
The number of Special Contexts is enlarge-able.
It does not exist in Rebol one method to find all Special Contexts.
> Well, I can show you how:
>
> new-bind: func [
> {bind a Word to a Context}
> word [word!]
> known-word [word!]
> ] [
> if error? try [return bind word known-word] [
> either loaded? word [
> first find first rebol/words word
> ] [
> first to block! mold word
> ]
> ]
> ]
1) We already know that we can create Special Words with to block!.
I should change my idea only if we can create them by successfull binding,
like with all other contexts!
2) If you are right, then
bind 'something SpecialW
> > Script Error: SpecialW is not defined in this context
is obiouvsly a bug and you should report it to RT, because here you should
create a new Special Word binded to SpecialW (so we should create
sub-collections of special words binded each other, but not defined).
In my vision, only the error message is little clear and i should ask RT to
change it.
> > We could call Special Context the Fail or Error Context. :-)
>
> The Fail Context or some such look well enough, maybe better than the
> Special Context...
I have thinked another name:
Alfa-Context
1) Alfa = the most simple state of word
(fails to bind any other word)
(the start, the beginning, like Zero)
2) Alfa = greek alfa privative => not a true Context
(if every words was special, the notion of context
and collection would be meaningless)
> > > Cheers
> > > Ladislav
---
Ciao (my english is bad)
Romano