[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Top level forms in a compiled file
- To: Bernard S. Greenberg <BSG at SCRC>, BENSON at NIMBUS, EAK at MIT-MC, common-lisp%SU-AI%USC-ECL at MIT-MC
- Subject: Top level forms in a compiled file
- From: BENSON at SPA-Nimbus
- Date: Thu, 14 Jul 1983 22:13:00 -0000
- In-reply-to: The message of 14 Jul 83 13:47-PDT from Bernard S. Greenberg <BSG at SCRC>
The evaluation order here is absolutely critical, and kills your whole thing.
It is completely reasonable and extraordinarily common to call functions
defined two lines above. I guess you could say, "Well, run it at the end,
not at the beginning", but there could be load-time forms in your functions.
This is handled in PSL by having function definitions add a call to FSET
to the list of top level forms to be compiled. It is exactly as if
DEFUN were just defined as a macro and didn't cause any special behavior
on the part of the compiler! Just wrap (lambda () ...) around
everything in the file, and compile it. (Not actually true, but the
behavior is the same.) E.g.
(defmacro defun (name &body body)
`(setf (symbol-function ',name)
Even defining a function twice in a single file and using both