[asdf-devel] asdf with-compilation-unit

Faré fahree at gmail.com
Tue Dec 13 16:54:49 UTC 2011


Dear Mark,

On Tue, Dec 13, 2011 at 11:36, Mark H. David <mhd at expressivedatabase.com> wrote:
> Well, I basically want the serial thing, but occasionally I want a group of
> things compiled using with-compilation-unit wrapped around them.
>
> In the example, I'd want the basic build to go something like
>
>  (load (compile-file "packages.lisp"))  ; assume compile-file returns the
> fasl's pathname
>  (load (compile-file "a.lisp")
>  (with-compilation-unit () (load (compile-file "b.lisp")) (load
> (compile-file "c.lisp")))
>  (load (compile-file "d.lisp"))
>
Unhappily, ASDF won't do that for you. What it WILL only do:

(with-compilation-unit ()
  (load (compile-file "packages.lisp"))
  (load (compile-file "a.lisp")
  (load (compile-file "b.lisp")) (load (compile-file "c.lisp")))
  (load (compile-file "d.lisp"))

I don't know what effect you expect from your compilation unit,
but if you require things to actually be compiled, they might not even be:
ASDF will gladly skip compilations that have already happened.

If for some reason I don't understand, you really want to do it your way,
ASDF will let you redefine do-traverse and perform, or you can have a
single file doing its own (eval-when (compile load execute) ...)
and use yourself the building blocks provided by asdf:
safe-file-write-date *compile-op-compile-file-function*
compile-file* compile-file-pathname*
you may even call asdf:operation-done-p and asdf:perform
with made-up operation and component objects.
Or if you don't need output-file redirection,
you can avoid using ASDF altogether.

Still I'm curious why you want a with-compilation-unit for...

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
The most preposterous notion that H. sapiens has ever dreamed up is that
the Lord God of Creation, Shaper and Ruler of all the Universes, wants the
saccharine adoration of His creatures, can be swayed by their prayers, and
becomes petulant if He does not receive this flattery. Yet this absurd
fantasy, without a shred of evidence to bolster it, pays all the expenses
of the oldest, largest, and least productive industry in all history.
        — Robert Heinlein, "Time Enough For Love"




More information about the asdf-devel mailing list