[slime-devel] Situation where I need (with-compilation-unit () ...) wrapped around both the load and the compile

Helmut Eller eller.helmut at gmail.com
Fri Jan 11 08:33:10 UTC 2013


On Fri, Jan 11 2013, Dave Cooper wrote:

> Hi All,
>
> So I think I have a situation with compiling and loading a file where
> it needs
>
>   (with-compilation-unit () (load (compile-file ... )))
>
> in order not to have spurious warnings about undefined functions.

The warning would still be there, regardless of the
WITH-COMPILATION-UNIT, right?

> If anyone is interested in details I can give as many as you would
> like, but first I'd just like to ask if, assuming this is a legitimate
> problem, it makes sense to take care of such a thing by extending
>
>   swank:compile-file-with-compile-file ?

Handling warnings and errors that occur during LOAD is quite tricky or
at least there is a wide variety of opinions what should be done.  We
probably want some test cases before we change it, just to make sure
that we don't do the opposite of what we did last time (and we changed
this many times by now).

> From studying the sources, it is not entirely clear to me where the
> actual
>
>    (load ... )
>
> is taking place, so I am not sure where one would wrap the
>
>    (with-compilation-unit () ...)
>
> even if it turns out that this will be a reasonable thing to do...

It works like this: 
 1. Emacs ask Lisp to compile a file
 2  Lisp sends the warnings back to Emacs
 3. Based on the warnings, Emacs can ask the user if the file should be
    loaded at all.  If there are no warnings, Emacs doesn't ask.
 4. Emacs tells Lisp to load the fasl file

So compile-file and load are currently not executed as a unit.

> Has anyone seen something like this or has any ideas?

A related issue with SBCL: if a function is redefined and the previous
version came from a different file, then it prints something like
"style-warning: redefining foo in DEFUN".  This happens during load
time, so SLIME does not report it as a compiler warning; it's simply
printed to *standard-output*.

Helmut





More information about the slime-devel mailing list