Who wants full block closures and why?

Alan Lovejoy sourcery at pacbell.net
Mon Jul 19 20:28:11 UTC 1999


> ** Original Sender: "David N. Smith \(IBM\)" <dnsmith at watson.ibm.com>
> At 16:01 -0500 7/17/99, Dwight Hughes wrote:
> >Benoit St-Jean wrote:
> >                 Personally, I find 'Orange' to be the answer I would
> >expect from the first test code.
> 
> So, closures have copies of external variable references from the 
> point at which they are created?
> 
> Dave

Not by definition, but they may in fact be implemented that way,
in certain circumstances.  By definition, a closure should bind
to the variables it references in outer contexts, which requires 
that they reference the entire activation frame of that outer
context.  However, it is often possible to prove (by static analysis)
that just copying the variable would preserve all observable
semantic properties of a proper closure.  It all depends on
what statements, if any, exist that (re)assign a value to the
variable in question, and when any such statements might
be executed.

--Alan





More information about the Squeak-dev mailing list