Subject: lifo closures
From: Matthai Philipose (matthai@cs.washington.edu)
Date: Tue Apr 10 2001 - 11:28:38 PDT
Thanks, Vass and Todd for your replies. I've appended them below. I
guess I had the "functional" view of a closure hard-wired in my brain,
and didn't consider that you could provide language-level support for
the other kind. Has there been any attempt to do
region-inference/automatic stack allocation in Cecil?
Matthai
-------------- Todd said:
Not sure if Vass's response answered your question. The basic
distinction
is whether the closure can escape the context in which it was created.
You need to do extra work in this case, allocating an environment that
goes around with the closure, so that free variable accesses will work
even after the activation record where the closure was created has been
removed from the stack, or whatever. For speed reasons, the compiler
doesn't do this extra work unless you use the && syntax for closures.
------------ Vass said:
>From a readme file:
The implementation distinguishes between fully-functional (but
slower) non-LIFO closures (identified with a leading && prefix) and
regular LIFO closures (identified with a leading & prefix, or if the
prefix is omitted altogether). If a LIFO closure turns out to be
non-LIFO and accesses a variable from a lexically-enclosing (but not
global) scope that has returned already, bad things can happen. Note
that some bad things include fatal errors during compilation; we
should fix things so that at least a warning message is displayed
whenever we detect statically that a closure is non-LIFO.
Vass
_______________________________________________
Cecil mailing list
Cecil@cs.washington.edu
http://majordomo.cs.washington.edu/mailman/listinfo/cecil
This archive was generated by hypermail 2b25 : Tue Apr 10 2001 - 11:28:03 PDT