Compiles corretly (i.e. without diagnosing errors) on Clisp 2.27. Zbyszek Jurkiewicz
On 21 Oct 2002, Adam Warner wrote: > > Hi all, > > I want to be able to create functions within the non-top-level of a > CMUCL program but am finding it is not possible to compile the file > (without having to load it first--this is not an option as the file > takes a very long time to run). > > Here's an example of the problem: > > (defun test (&rest args) > (declare (ignore args)) > nil) > > (defmacro defun-grab (name lambda-list &body body) > (let ((defun-form `(defun ,name ,lambda-list ,@body))) > `(progn > (eval-when (:compile-toplevel :load-toplevel :execute) > (defparameter ,name ',defun-form)) > (eval-when (:compile-toplevel :load-toplevel :execute) > ,defun-form)))) > > (test > (defun-grab plus1 (number) (1+ number)) > (write plus1)) > > > This is what happens when trying to compile the example file: > > In: defun-grab plus1 > (defun-grab plus1 (number) (1+ number)) > --> progn eval-when defparameter progn > ==> > (setq plus1 '(defun plus1 (number) (1+ number))) > Warning: Undefined variable: plus1 > > > Warning: This variable is undefined: > plus1 > > > Compilation unit finished. > 2 warnings >
