[REBOL] Re: Context - code included- 2nd version
From: lmecir:mbox:vol:cz at: 10-Sep-2001 20:47
Hi,
...snip...
> I try to think at the Global Context as the target of Load (and other
> functions like to-word) which is the default loader for a block. I think
of it
> as the the load-context (or default-context).
>
> I should like to know all the functions which make a implicit-explicit
load.
> Can you help me?
>
> to-word
> to-lit-word
> to-set-word
> to-get-word
> load
> do (all but block)
I don't think the last one is correct...
> ... ?
to
make
> I think that your Special Context is not a true Context, it is not a
context
> at all, it has not the aspect and the use of a context, which is to give a
> value to a word.
I am trying to comply with the official documentation if possible:
special: first to block! "a"
set special 1
** Script Error: a is not defined in this context
** Where: halt-view
** Near: set special 1
This is how I can interpret it:
1) the word 'a stored in 'special is "in a context"
2) it is "in a context" where it "isn't defined"
3) I call that context the Special Context
OTOH, it is my definition. For me it is the simplest definition. Didn't try
to invent any other, I confess...
> It is only the class of words out of context
> (decontextualized). I can understand "special word", but not "special
> context":
>
> words
> binded (many Contexts) not-binded (out of context)
> So i do not like your visualize-context when it returns first system/words
for
> Special words. First system/words is only one big collection of Special
word,
> but it is a collection like another. If I do a:
>
> to-block read %italianvocabolary10000words
>
> i have created 10000 special words which v-c does not see. It instead
return
> me 3k words among which there is none of my 10k italian words. So i think
that
> v-c must return a [] or none for special words, also because they have no
> context.
As to whether the Special Context is a Context: it depends on definition. I
wrote a definition which is telling me, that it is a Context. Your
proposition reflects my implementation of V-C as I wrote it 24/7/2000.
> > > local?: func [
> > > {find out, if the given Word is a Local Word}
> > > word [any-word!]
> > > ] [
> > > found? all [
> > > binded? word
> > > not global? word
> > > ]
> > > ]
> >
> > This notion is less useful than the notion of Local Words I prefer,
because
> > from two Words of the same Context the first one may be "local" while
second
> > "non-local".
>
> Here I do not see any difference between your and mine implementation. Can
> explain it to me?
Sorry, I just didn't read what was written, you are right.
> > > in-object?: func [
> > > {find out, if the given Word is defined in a object-context}
> > > word [any-word!]
> > > /local self
> > > ] [
> > > found? all [
> > > binded? word
> > > not same? 'self bind 'self word
> > > equal? object! type? get/any bind 'self word
> > > ]
> > > ]
> >
> > the last function is incorrect (and incorrectible, IMO), e.g.:
> >
> > o: make object! []
> > o/self: 11
> > in-object? in o 'self ; == false
>
> You are right, it can fail also if you globally define:
>
> self: system/words
>
> or
>
> o: context [self: system/words]
>
> I have tried to correct the last 2 incorrect behaviour in another version.
I
> find
> it useful for visualize-context: it can reveal the object-local-unloaded
words
> that your implementation do not find at all. If the function fails,
> visualize-context can default to the old scheme: scanning system words.
> When this function return true, it is true, when false, it is undefined.
May be interesting
Cheers
Ladislav