From: Richard M K. <kr...@pr...> - 2008-09-03 21:16:28
|
Gary King <gw...@me...> writes: > I'd like to build a system A that loads certain files if and only if > some other system B is _not_ loaded. One natural way to do this would > be to have system B push some feature (call it :b) onto *features* and > have system A say something like > > :components ((:file "something-like-b" :depends-on ((feature > (not :b))))) > > which is supposed to say "compile and load the file 'something-like-b' > if the feature :b is not present when you actually get around to > loading this system. Depends-on isn't quite the right term but I'm > hoping to keep changes down to a minimum. > > The above won't work both because ASDF can't express anything about > the absence of a feature and because you can't depend on a feature > being present in the depends-on clause. The closest I think you can > get now is > > :in-order-to ((:compile-op (feature :foo)) (load-op (feature :bar)))) > > Is there some other to express what I want? Is there some reason that > I shouldn't be trying to express this at all! > > (Lastly, if there is any sense to this "include file iff some feature > is present / absent, then why not generalize and allow > > ;; more complex feature tests > (:file "some-file" :include-when ((feature (:and :foo (:not :bar)))) > > ;; more general computation > (:file "some-file" :include-when ((test (some-predicate-i-know-not- > what-p))) > > (In the last psuedo-example, I'm imaging that the current component > and system are available via specials.) > > thoughts and comments welcome, I think I came across this once before: http://article.gmane.org/gmane.lisp.cclan.general/583 (Earlier posts in that thread that are mostly me being mislead by the asdf manual at the time.) What does feature-testing have to do with REQUIRE and PROVIDE (which deal with *MODULES*, not *FEATURES*)? -- Richard |