Eval-invisible let bindings
P T Withington
ptw at pobox.com
Fri Dec 7 08:00:25 PST 2007
On 2007-12-07, at 05:06 EST, Lars Hansen wrote:
> That may in turn require heap-allocating individual
> captured storage cells in order to avoid capturing entire rib objects,
> which in its turn may cause overall slowdowns in code that does use
> closures.
My experience is that closures are poorly implemented in current es3
runtimes because they don't do this analysis and instead capture the
entire environment, making them _much_ more expensive than allocating
an instance. My Lisp experience is that the compiler can warn when an
'indefinite extent' (upward) closure is being created to help the
programmer avoid those (and the compiler can stack-allocate the
captured state for 'dynamic extent' (downward) ones). Some languages
eschew closures altogether because they are isomorphic to instances,
but with explicit allocation. Personally, I find downward closures a
powerful structuring tool, so I am glad we have them; but upward
closures can be difficult for even the expert to spot, so I hope
implementors will give us a hand there.
More information about the Es4-discuss
mailing list