[asdf-devel] Optional dependencies

Tobias C Rittweiler tcr at freebits.de
Thu Aug 19 08:13:25 UTC 2010


Quite a few libraries come with reader hacks. They usually
come with a ENABLE-FOO-SYNTAX function. I'd like those
libraries to optionally depend on the named-readtables
library, and define a named readtable that includes their
hacks. So users can just use (IN-READTABLE FOO:SYNTAX)
on a per-file basis.

What do you think would be the best way to do it?

There's :weakly-depends-on which only loads a dependency
if that system is present. Named-readtables pushes
:NAMED-READTABLE to *FEATURES*. So in principle, people
can use

  (:weakly-depends-on :named-readtables)

and then

  #+named-readtables
  (named-readtables:defreadtable ...)

Or put that definition in a file readtable.lisp and
use feature-conditionalized compilation in the system
definition (which used to be, and I guess still is,
awfully awkward -- I never remember how to do it.)

Now I'm wondering how good that solution is.

What is if the library was compiled with a core that
happened to include named-readtables? Trying to load
that fasl with another core file would probably result
in an obscure error. Now, it's a shoot-yourself-in-the-foot
kind of thing to do, but I'd think it's something that
can happen quite easily. Does ASDF somehow guard against
this case?

>From what I can see, it appears that :WEAKLY-DEPENDS-ON 
was added in a quick rush thinking that it might be
appropriate for conditional compilation, but it really
is not. Does that seem true to you, too?

Maybe people can share how they got bitten by it?

I'd think ASDF should include a ./configure step (there
are extension for that kind of thing out there), and
should then save configuration choices persistently,
and check for these when loading a system. 

  -T.

PS.

Thanks, appreciation, and kudos again to Fare and Robert
for having taken up the ASDF hat.





More information about the asdf-devel mailing list