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

Basic Design Questions

    If you have a lexical Lisp without closures, how do you deal with
upward funargs?  Dump core?  Pascal gets away without closures by not
having first-class functional values; this doesn't seem to work very
well in Lisp.  Alternatively, the compiler could signal an error
whenever it couldn't prove you weren't creating a closure.  That would
be even sillier, since the compiler would be doing all the work of
implementing closures without getting any of the benefit.  You
certainly wouldn't want warts like these in an "educational subset."

    An interesting point in favor of the function/variable split is
that it makes macros work better.  Most bindings in programs are
variable bindings, while most global references are function
references.  If the program binds something that the macroexpansion
references then the macro won't work.  This is because macros aren't
referentially transparent.

    If the bindings that a program makes don't intersect with the
functions that the macroexpansion is trying to reference, then the
macro works.  If the set of global references is mostly disjoint from
the set of local bindings, then more macros will work the first time.
Separating the functional and normal values tends to have this effect.
Yes this is an ad-hoc kludge, but that's what Lisp is all about.  Lisp
is getting things done that we don't yet know how to do right.