Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Context - code included- 2nd version

From: rotenca:telvia:it at: 10-Sep-2001 12:32

> Hi Romano,
Hi Ladislav, thank you for your precise comments!
> some comments: > > binded?: func [ > The above is exactly the opposite of what I want to call a Special Word.
Very well!
> > loaded?: func [ > This notion is your invention and it surely deserves our attention! The fact > is, that one Rebol Context (as you have proven) can consist of Loaded as > well as Not Loaded Words (except for the Global Context, which cannot > contain Not Loaded Words, of course...). The implementation cannot really > handle ANY-WORD! values.
I admit: didn't checked arguments! I cloned one for all function! I thinked only at word! datatype! 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) ... ?
> Word, because it is only a subcollection of the Special Context I tried to > define. It is not a Context.
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. 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) Loaded/unloaded says only if the global context has a copy of the word. Can be useful to check "global-transparent" code. 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.
> > 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?
> > 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.
> Cheers and thanks again. > Ladislav
Thank you for all your work! -- Ciao Romano