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

[REBOL] Re: ROUND function (like TRUNC, FLOOR, etc...)

From: g:santilli:tiscalinet:it at: 22-Feb-2002 23:54

At 16.31 21/02/02, Joel wrote:
>I can think of at least two simple ways: > > >> use [counter] [
[...] This does not give you a direct reference to the context; you'll need to reference it indirectly via a bound word. (That might be less intuitive...) It also requires you to know the "local words" in advance.
>It seems to me that these are equally simple to write and use as long
The differences are very minor, but IMHO they justify the choice of MAKE OBJECT! versus USE for CONTEXT.
>Minor differences in simplicity aside, each of these cases creates >a context and provides an interface to manipulate the state of that >context.
So, if you were to write a mezzanine to create a context, which would you choose? Objects look like the most obvious choice IMHO...
>1) ask for the context of a specific word;
That would be useful, but mainly only if you were able to ask CONTEXT! what other words it has, and things like these; i.e. only if it behaved like OBJECT!. (Which is like asking RT to turn every CONTEXT! into an OBJECT! --- pretty ironic conclusion for a thread that started with "'CONTEXT is a confusing name for a function that makes OBJECT!s". :)
>2) use a context as the explicit second argument to BIND;
If you already have a word bound to it... (Well, that said, I'd like to have BIND accept at least OBJECT!s, to avoid that extra IN, but even more to accept functions etc. to avoid all the magic needed to get to it...)
>4) be able easily to ask whether two words belonged to the > same context;
That's a point. :)
>5) ask whether a specific word belonged to a specific context;
Two points. ;)
>and so on ... Making contexts first-class would be consistent with >the REBOL approach that "everything is just a value" and would likely >help de-mystify some of the more interesting things that REBOL can do >that can't even be *said* in some other languages.
I agree here. (I second Ladislav in his desire to have all REBOL types as first-class.)
>A nice notation for (1) would be > > context some-word
I'd say CONTEXT-OF, or GET/CONTEXT (this looks pretty consistent and clean --- with GET you have the value, with GET/CONTEXT you have the context; you could even replace BIND with SET/CONTEXT... :). Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r