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

Re: Closure, Null Lexical Env.

"(eval '#'(lambda (x y) ...) nil)" does seem to be the best (only?) way
to express "closure over null lexical environment" in common-lisp.
There is no reason for the compiler to not compile this.  Both the
arguments to "eval" are constant, and there are no environmental
dependencies.  This can be compiled for the same reason that "(+ 3 4)"
can be turned into a "7" at compile time.  The constant list "(FUNCTION
(LAMBDA ...))" would not have to be preserved in the compiled code for
the same reason that the "3" doesn't.

I realize that probably no existing compiler compiles this, but it would
seem an easy change to make.  As easy as adding some other language
construct to create such closures, but without making the language
definition any bloody larger.  Any program which assumed this
enhancement would continue to work on current implementations (although