Galt wrote:
>Jeff and Brian, you guys are terrific help, and I really
>appreciate it. Hopefully some of the other people
>on the list have the same questions as me and are
>benefitting from your wisdom, too.
Flatterer :)
>Brian, one little interesting point, as you may have
>seen from Ladislav's generous note:
>---------------------------
> > Did this used to work in an older rebol without compose?
> >
>Here you are:
>
>REBOL
>1.0.3.3 (Win32 x86)
...
>So, it did used to work in an older Rebol.
This is interesting! I kind of thought this might be the
case, but I didn't check. Learn something old every day!
But compose was added much later than this. The initial
2.x versions didn't have it either. The changeover from
the Scheme engine to the stack engine didn't have much
to do with compose.
>So, is it safe to say that a context is associated
>only with a word? Or is a word assoc. with a context?
A word is associated with a context, by the bind function
or some internal equivalent.
>Or only words that are functions are associated with
>a context??
Words are not functions. Functions are first-class values
that can be assigned to words like any other value. This
distinction is a good one to keep in mind with REBOL.
>Does each function have one context?
By default, yes. When the function is recursed into a new
context has to be created to make it reentrant. When that
function returns, the new context is lost. The original is
still there to be reused, though. Recursive functions are
much like using the USE operation, with all of the overhead
and GC-related context concerns.
>What about dynamically generated functions not referred
>to directly by assigning to some 'word ? Do these
>automatically have a context, too?
Yes. The context is associated with the function value, not
any words that may have that value assigned to them.
>Is rebol's use of context similar enough to another language
>out there that I could get some good guidance by referring
>to that language's documentation/literature ?
At the high level, REBOL behaves much like Scheme or some
other lisp-like language, or maybe Smalltalk. At the low
level, it behaves more like an intermediate language for a
compiler. Some have said that Forth might be similar, but
I haven't verified it. Other aspects of the engine are a
bit Forth-like (stack-machine), but the high level REBOL
syntax and semantics are quite different.
So far, conversations on this mailing list have been the
best documentation for low-level aspects of REBOL context
handling. Someone should probably codify those some day.
It should probably be me. But I've been too busy, or more
likely too lazy. I'm waiting for the Official Guide, to
see if it covers the subject properly. If not, I'll just
have to do it, probably as a page on my web site. It's
too minimal a site anyway...
>Thanks! to everyone on the list who has been helping me
>out here with getting a better understanding of Rebol.
>I am going to print out those notes to study them better.
Any time!
Brian Hawley
(There is another Brian on the list, so I have
to sign my whole name all the time now...)