From ... From: Erik Naggum Subject: Re: Using compile on an ##1/1 X-Deja-AN: 398719177 References: mail-copies-to: never Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * kturvey@www.sprocketshop.com (Kenneth P. Turvey) | I am trying to convince Allegro Common Lisp to compile a function that | is put together at run-time. you didn't say which version of Allegro Common Lisp, nor did you show us what you tried to do, yet both are necessary to understand your problem. nonetheless, I can guess: your ACL version is 4.3.1 or earlier, and you attempt to do the equivalent of (compile nil #'(lambda (...) ...)) which fails in ACL 4.3 and 4.3.1, and probably also in earlier releases. the following advise will make COMPILE in ACL 4.3.1 (and probably in earlier releases, as well) accept interpreted functions as the second argument, which ACL 5.0 accepts: (advise compile :before compile-interpreted-functions nil (when (interpreted-function-p (second arglist)) (setf (second arglist) (excl::func_code (second arglist))))) note that this will _still_ fail on closures. it also appears that no matter whether there are references to bindings in the closed-over environment, ACL 5.0 will also create a closure object, making it impossible to compile any internal functions this way to begin with. (note: similar advice is needed for DISASSEMBLE in both 4.3.1 and 5.0, to accept interpreted functions as arguments.) however, compiling the containing function always also compiles internal functions, so this situation seems impossible in the first place. now, I have to assume you do something really weird, like calling COMPILE on a function object that would already have been compiled in a compiled function, but which fails in a uncompiled function. in that case, just omit the inner call to COMPILE, and compile the containing function. if you really want to construct a new function that does not reference any closed-over bindings, only their values at compile time, you _could_ do something like this: (compile nil `(lambda (...) ... ,whatever ...)) where WHATEVER is whatever variable whose value you want to be constant in the code. well, all this is without knowing what you try to do or how you do it, but I hope it provides some leads. #:Erik