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

On USE [was Re: WYSIWYG programming]

 [1/2] from: joel:neely:fedex at: 30-Oct-2000 8:12


[rebol-bounce--rebol--com] wrote:
> Well, the definition of contexts is context dependent. :) > > I have an operative definition of contexts that works for > me: "where a word is looked up"
Such a short statement is either too obvious or too cryptic to be useful. What's needed are clear statements of when contexts are created, what statements cause such creation, and what contexts are used in "interesting" circumstances. For example: Asking REBOL to DO a string gets a different result from asking REBOL to convert a string to a block and the DO the block. The first seems to use the global context, while the second does something (?) else. However, if the string is explicitly LOADed (either with *or* without being converted to a block) the global context seems to be used.
>> x: "global" == "global" >> do "print x" ;-> global >> do to-string "print x" ;-> global >> do to-block "print x"
** Script Error: print is not defined in this context. ** Where: print x
>> do load "print x" ;-> global >> do load to-block "print x" ;-> global
do func [s x] [ x: "local" if error? try [do s] [print "***error***"] if error? try [do to-block s] [print "***error***"] if error? try [do load s] [print "***error***"] if error? try [do load to-block s] [print "***error***"] ] "print x" "ignored" global ***error*** global global == none So... HOW do we determine, under all circumstances, "where a word is looked up"? -jn- ---- (Not meaning to be rude, just trying to be compact! ;-)

 [2/2] from: g::santilli::tiscalinet::it at: 30-Oct-2000 15:52


Joel Neely wrote:
> So... HOW do we determine, under all circumstances, "where a word > is looked up"?
It can only be determined knowing the complete "history" of the word. BTW, TO-BLOCK behaves differently than LOAD because it doesn't BIND it to system/words, leaving words without a context (thus the error message). Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/