[REBOL] Re: UHURU unit structure
From: g:santilli:tiscalinet:it at: 29-May-2001 14:32
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? :-)
; *every* set-word found here will be made "local"
make-module/global [a b c] [
; *every* word except 'a, 'b and 'c is "local"
It wouldn't be too difficult to implement IMHO.
> However, there's no "thing" which holds state that methods
> are working against, hence there's no benefit to forcing
> the down-stream programmer either to think in terms of an
> object, nor to have to repeat prefixes over and over as in:
> hyp-trig: UHURU/make hyperbolic-trigonometry
> a: hyp-trig/sinh x
> b: hyp-trig/cosh y
> c: hyp-trig/tanh z
> ; and so on
Also, doing so would force REBOL to do a dynamic lookup, so it
could slow down things in some cases. (Of course, the user could
always export them manually, like:
sinh: get in hyp-trig 'sinh
but why not doing it automatically then?)
> It's up to the user of the unit to set those values wherever
> (s)he wishes.
or even better, using a dialect:
import-module some-module [
exporting [a b c]
exporting [d e f] as [g h i]
exporting this as that
My two cents,
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/