[asdf-devel] Optional dependencies

Vsevolod Dyomkin vseloved at gmail.com
Fri Aug 20 21:02:15 UTC 2010


Hi Tobias,

One thing, that you might want to use instead of :weakly-depends-on is
feature dependencies.
The syntax is (:feature <feature>) in dependency list, like this:
(defsystem #:test
  :depends-on (#:cl-ppcre
                            (:feature :custom-readtables))

Although, I didn't try it in modules, but I guess, it should work there as
well, since the mechanism is generic. Proceed at your own risk... ;)

Best,
Vsevolod


On Thu, Aug 19, 2010 at 11:13 AM, Tobias C Rittweiler <tcr at freebits.de>wrote:

>
> 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.
>
>
> _______________________________________________
> asdf-devel mailing list
> asdf-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20100821/473bb36a/attachment.html>


More information about the asdf-devel mailing list