This raises a question, Jan. What is the full set of variable bindings in Smalltalk (VW). Global, makes some sense, but what about semi-global and local. Would this be the difference between external bindings in a closure versus argument bindings to the closure?
The next step from here seems to be the impact of namespaces on these concepts. Or rather, do these concepts help in the structuring of a namespace?
cheers, Rob
"demiourgos@smalltalk.org" wrote:
On Thu, 27 January 2000, Robert Withers wrote:
I was looking at Lisp Lambdas and at BlockContext and BlockClosure. It seems that lexical closures ala Lisp and BlockClosures do this closing over the variables. It looks like a BlockCLosure makes copies of all of the referenced variables in the block. I don't understand a few things about this.
- At what point in the lifecycle are the copies of bound variables made?
and
- Are they deep copies? It seems that you could navigate to an internal
Object of a bound object and that may have changed in the meantime.
Robert,
I can't speak for Squeak, since I'm not that familiar with its innards, nor, really, for Common LISP, but I am familiar with what used to be called MacLisp and an IBM Research (Yorktown) LISP once known as LISP/VM. The former had the machinery to build these "contexts" but AFAIK didn't have them built-in. In LISP/VM, however, there was a function called "context" which returned a pointer to a complete set of variable bindings: local, semi-global, global, and if one did
(setq x (context))
then later
(eval <expr> x)
the evaluation was done in the context "frozen" by the call to "context". The idea here was to provide a cheap way for "backing up" in the exploration of a problem and forgetting about everything touched since.
There was one exception that prevented endless looping, I believe. (And I apologize in advance, because I'm a little fuzzy on this.) If one evaluated
(context x)
in the context specified by the value of x, it would return NIL.
--jtg
[snip]
Jan Theodore Galkowski www.smalltalk.org/ http://www.scguild.com/usr/1707I.html demiourgos@smalltalk.org www.marssociety.org/
PGP Key Fingerprint: 2757 F86D AA51 677D 38D7 964B 9A8D 7852 A494 3790
Get my Public Key from my home page at: http://home.stny.rr.com/algebraist/
Get free e-mail at http://www.britannica.com
squeak-dev@lists.squeakfoundation.org