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

Closure, Null Lexical Env.

From: Steve Bacher at Draper Lab
Subject: Constructing a Closure over the Null Lexical Environment

Replying to a previous message from Miller.pa@Xerox.COM

> What about
> (EVAL '#'(lambda (x y) ...) NIL)

(eval '#'(lambda ...) nil) probably won't create a compiled definition,
because the interpreter (eval, that is) may create an interpretive
lexical closure when it sees (function ...), unlike the compiler which
will create a compiled lexical closure.  In any case, the lambda
expression won't be compiled in (QUOTE (FUNCTION (LAMBDA ...)), which
makes sense when you think about it.

I don't think #.(eval ...) would necessarily work either, for the
reasons mentioned above.  Thought:  Does CL specify anything about
the nature of what is returned by #'(lambda ...) when it is evaluated
(as opposed to being compiled)?  In particular, do the interpreter and
the compiler have to return isomorphic objects (as opposed to
merely functionally identical objects)?
Consider what DEFUN does in both contexts (I'm not talking about
those famed implementations that compile DEFUN's on the fly).