Hi,
David Steuber wrote:
SLIME or Swank (perhaps the swank-openmcl backend) are definitely doing something to make this take a long time. I just have no idea how to figure out what.
I suspect some interaction between EVAL-WHEN and top-level vs. non top-level. I've also had a couple of situations (in CLISP, cmucl or sbcl, but I forgot which package and when) where e.g. C-c C-c would not work and even spit out incomprehensible error messages, while e.g. C-x C-e followed by (compile 'foo) would work fine.
My belief is the difference that evaluating (funcall (compile nil '(lambda() (defun foo ...)))) -- which is what I believe SLIME does (cf. swank-compile-string) -- may have different results from evaluating 1. (defun foo) -- causes it to be defined at top-level 2. (compile 'foo) Look at the CLHS apropos EVAL-WHEN and you'll see the door open to a lot of hairy behaviour. People mostly using COMPILE-FILE on lots of top-level definitions will never encounter that, because it's the typical, well-tested use-case. The above is not. You'll be hit by these differences when you'll see non-trivial EVAL-WHEN ... in the macroexpansions of the forms you evaluate or compile individually in SLIME.
Sigh, I wish I had kept notes about those non-top-level problems, to beter talk about these.
BTW, IIRC, there's a few situations where the old lisp-mode (inf-lisp.el) is less likely to run into trouble than SLIME, precisely because it just uses a simpler way to compilation and evaluation. Again, I forgot the details.
Also, I've wondered whether platform-specific solutions may help. E.g. in CLISP, (locally #+clisp (declare (compile)) ...whatever...) might be a better approach to compilation, devoid of top-level vs. non top-level EVAL-WHEN expansion issues. CLHS specifies that LOCALLY maintains top-levelness, but (declare compile) is specific to CLISP. Actually, I think this could be an excellent idea for swank-clisp:defimplementation swank-compile-string. Or just use (load (make-string-input-stream "(print 123)"):compiling t :verbose nil)
[looking closer at swank-*.lisp] Well forget about my talking, it appears only clisp uses (funcall(compile(lambda #))). Allegro, Lispworks, sbcl, openmcl go through a temp file, and cmucl uses ext:compile-from-stream on a string-input-stream, at least in slime-1.2.1.
Regards, Jorg Hohle.