From: Jeremy B. <jh...@it...> - 2007-01-17 18:22:38
|
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. Details: 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 (compile-file "second.lisp") (compile-file "first.lisp") sbcl will print a message about an undefined reference in second.lisp. If, in a fresh lisp, you call (with-compilation-unit () (compile-file "second.lisp") (compile-file "first.lisp")) 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, (with-compilation-unit () (load "first.fasl") (compile-file "second.lisp")) will not print an undefined-function message, but in a fresh lisp, (with-compilation-unit () (compile-file "second.lisp") (load "first.fasl")) *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. Jeremy |