On Sat, Nov 2, 2013 at 3:53 PM, Zach Beane xach@xach.com wrote:
Speaking of which, I have a defsystem that looks like this:
(defsystem #:system :weakly-depends-on (#:weak-dep) :depends-on (#:dep) :defsystem-depends-on (#:defsystem-dep) ...)
If I have the system object in hand, what's the easiest, most direct way to get a list of the dependency names ("weak-dep" "dep" "defsystem-dep")?
tl;dr: * (and (slot-boundp system 'asdf::defsystem-depends-on) (asdf::system-defsystem-depends-on system)) * (asdf:component-sideway-dependencies system) ;; or if compatible with asdf2, (asdf:component-sideway-dependencies system)
For defsystem-depends-on dependencies, there's asdf::system-defsystem-depends-on aka asdf/system:system-defsystem-depends-on in ASDF3. Unhappily, the slot is sometimes unbound (e.g. for preloaded systems), which is probably a bug (Robert, are you on it?), and you need to test for (slot-boundp system 'asdf::defsystem-depends-on) (exported from asdf/component — why isn't it in asdf/system? That's probably another bug. That said, it shouldn't be "just fixed" without running the upgrade test — I believe a :recycle asdf/component is then needed in asdf/system. At the very least, it should be flagged for fixing in case there's ever a backward-incompatible ASDF4).
For depends-on and weakly-depends-on, unhappily, there is only one reader for the resulting dependencies, called asdf:component-sideway-dependencies (also defined and exported in asdf/component), at least it's always defined. For compatibility with the later version of ASDF2, you can use asdf::component-load-dependencies instead. Problem is, I've never liked weakly-depends-on, and I never gave the feature much love. I even flagged it as ;; ASDF4: deprecate this feature and remove it. Of course, it's now up to the new maintainer. If the feature is here to stay, it probably needs some love. If the feature is going away, users need to be identified and provided with a way out. Personally, I much prefer explicitly loading a system foo+bar, such that foo has a hook, and foo+bar hooks the functionality of bar into foo. Failing that, I recommend using asdf-system-connections, that defines and automatically loads such a system foo+bar when both foo and bar are loaded. My point of view is that anything that makes system construction non-deterministic, conditional on the environment, sensitive to the order in which things are defined or otherwise surprising or hard to track is only going to make things harder in the end.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The last good thing written in C was Franz Schubert's Symphony number 9. — Erwin Dieterich erwin@cvt12.verfahrenstechnik.uni-stuttgart.de