[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dynamic closures



Let me point out that it is trivial to implement dynamic closures in a
shallow-bound system with no extra cost for special-variable accessing and
storing, as long as you are willing to make BOTH entering a closure and
leaving a closure expensive.  The only reason the Lisp machine did it the
way it did was to enable the normal special-variable unbinding mechanism to
be used to leave the environment of a closure.  Thus only entering a
closure is expensive.  If you're willing to copy values in and out, even
when you throw through the application of a closure, and to search the
binding stack if a closure is called recursively, you don't need invisible
pointers.

In a deep-bound system, you have already paid the cost of closures and
adding them costs nothing, of course.

Certainly many of the uses of dynamic closures are better done with
lexical closures, when you have a full upward-funarging lexical Lisp.
I doubt that no uses for dynamic closures remain (unless you are a
purist like Rees and believe that no uses for dynamic variables
remain).  However, I have not yet thought out the issues.

I have no opinion one way or the other as to whether dynamic closures
belong in the Common Lisp kernel language.  Certainly the Lisp machine
will not get rid of them.