In with-compilation-unit, forward-references to functions which are
defined by loading (but not compiling) files are spuriously reported
as undefined. So, for instance, incremental rebuilds with asdf print
spurious messages about undefined functions.
In sbcl, with-compilation-unit defers reporting references to
undefined variables, functions, etc. within its dynamic scope, and
doesn't report things that are eventually defined.
Given a file first.lisp containing one line:
(defun foo () 1)
And a file second.lisp containing one line:
(defun bar () (foo))
If, in a fresh lisp, you just call
sbcl will print a message about an undefined reference in second.lisp.
If, in a fresh lisp, you call
you won't get the message. So far, so good.
The behavior I don't like is that with-compilation-unit doesn't notice
functions defined by loading files *after* compiling files which
referenced them. To demo this, in a fresh lisp,
will not print an undefined-function message, but in a fresh lisp,
*WILL* print such a message.
This behavior causes incremental compiles with asdf to print messages
warning you about any forward-references made in files that are
recompiled when the forward-referenced files are not also recompiled,
but merely loaded. This, in turn, makes it impossible to be anal
retentive about "no undefined references" unless you delete all your
.fasls before every build.