[cmucl-imp] Forgetting compile time stuff

Rob MacLachlan ram at ri.cmu.edu
Wed Dec 23 14:39:00 CET 2009


Helmut Eller wrote:
> After compiling a file with content:
>
> (eval-when (:compile-toplevel)
>   (defun foo () (format t "foo~%")))
>
> with (compile-file "foo.lisp") the function foo is defined
> after compile-file returns.
>
> Is there a knob to change that so that foo is defined only while
> compiling?
>   
No, there isn't, and traditionally people have relied on this behavior 
so that if you compile a file of macro definitions that uses helper 
functions or has global state variables, those definitions will stick 
around to be used in subsequent compilations.

There would also be severe implementation difficulties with such a 
feature because arbitrary code may be evaluated and there is no facility 
in CL for undoing evaluation.  However, it might be almost possible to 
do such a thing in CMU CL because of the pervasive use of first-class 
environments to hold global state (the globaldb.)

  Rob




More information about the cmucl-imp mailing list