[asdf-devel] asdf with-compilation-unit

Mark H. David mhd at expressivedatabase.com
Tue Dec 13 18:01:19 UTC 2011


Hi.

I'd like the compilation of all the files in the unit to happen when any 
of the files in the unit need compilation.

Then, when they're all compiled, I'd like with-compilation-unit wrapped 
around their compilation.

I guess I want the option to do ':override true', or have that be the 
default, around this compilation unit, since it's apparently in a 
compilation around the entire system.

(Well, I didn't know until now that the whole set of files in a serial 
build are in one compilation unit.  So you get no warnings for any 
forward references between files?)

The effect would be that warnings for things like variable or functions 
not defined would be deferred until the end of compiling the unit.

Example:

I'd like the following individual compilation units:

package.lisp, a.lisp, b.lisp and c.lisp, d.lisp

Then, assume

a.lisp defines f1, which calls f2.
b.lisp defines f2, which calls f3.
c.lisp defines f3.

So, in this case, I'd expect a warning when a.lisp is compiled that f1 
calls undefined function f2.
But when b.lisp is compiled, I'd expect no warning for f2 calling f3, 
since it's defined in the same compilation unit (in c.lisp).


(Well, I didn't know until now that the whole set of files in a serial 
build are in one compilation unit.  So you get no warnings for any 
forward references between any files?  I guess I'd like a way to defeat 
that, too.)

On 12/13/2011 11:54 AM, Faré wrote:
> 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