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

Compiling anonymous functions embedded in structure

Instead of saying #'(LAMBDA ...) which the compiler doesn't recognize
as something to compile, you could say (DEFUN TEMPNAME ...) then explicitly
copy that codepointer from the function cell of TEMPNAME to the place it's
really wanted. This is a simple way for the esoteric programmer to get around
this deficiency in the compiler.

By the way, PSL is strange in this respect. When *COMP is turned on so that
forms typed into the interpretor get compiled, it recognizes only PUTD as
a trigger for actual compilation (which in turn is generated by macro expansion
of DE et al), thus it fails to compile the (SETF ... (FUNCTION (LAMBDA ...))).
But when compiling file-to-file using FASLOUT, absolutely everything in
the file is compiled, the toplevel cruft being put in initcode and the stuff
inside (PUTD ...) or (FUNCTION ...) being put in permanent BPS, so that
the original (SETF ...) actually compiles as desired without needing the trick.