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

[REBOL] Re: UHURU unit structure

From: agem:crosswinds at: 29-May-2001 20:07

>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 29.05.01, 13:32:33, schrieb Gabriele Santilli <[g--santilli--tiscalinet--it]> zum Thema [REBOL] Re: UHURU unit structure:
> Joel Neely wrote: > > Namespace collisions are a monumental pain in code reuse. > > The simplest way to avoid any such collisions is for each > > unit to be an object that *NEVER* messes with any namespace > > except its own, IMHO. > make object! [ > f: func [a] [ > b: a + 1 > ] > ] > We really need modules, eh? :-)
the trick here is to change the script. This can be done automatic, as long as the human knows how it works. With my contexter you would write the script with the function and it would create the object with all locals (and some overhead i found handy.) It creates a %ctx-script.r from a %script.r . it looks for set-words, [set 'word], [set [a b]] and [parse s[copy piece]]. Can be extended. It uses the header-entry [confusing: [words]] for words which could be local, specially [parse s[copy piece]] and [a: copy first b] are confusing. Also it has a list of rebol-words, build from a clean rebol. It warns if a selected local is in this list, giving chance to copy this in confusing. (but shows that on console yet, ugh). Exporting the interesting words to global context is also supported, there is a 'dial in the object to do this. Header-entry [export: [words]] For me thats handy, working on console, [ed/dial] and i have the usefull editor words there. Not as good as real modules, but handy. Till now only personal used, needs some feedback for docu, better names, and so on..
> Or just: > make-module [ > ; *every* set-word found here will be made "local" > ]
note 'copy in a 'parse is like a 'set, easily overlooked.. but not in usual code..
> make-module/global [a b c] [ > ; *every* word except 'a, 'b and 'c is "local" > ] > It wouldn't be too difficult to implement IMHO.
Mentioning happily again ;declare in the importing object import: func [words src] [set words reduce bind/copy words in src 'self] ;then import [want this and that] the-other-object :) (would need handling in contexter then similar to set..)