Liam Healy wrote:
I am using asdf-system-connections and notice a glitch in its design. As the original author no longer maintains it, I'm try to fix this myself. This system is designed to allow the loading of a connected system (say "A") automatically when two or more dependent systems (say "B" and "C") are loaded. The problem I'm encountering is that when another system (say "D") is defined to depend on B and C, then A is not loaded until after D is done loading, but D may need the definitions in A. asdf-system-connections defines a function load-connected-systems which does the work of loading the connected system definitions, but this is called from a new #'operate :after method which apparently doesn't get called until A is done loading.
That is to be expected, since OPERATE is the top level call. Any :AFTER method will be called at the end of all operations (more specifically, after executing the build plan).
I am looking for a place from which to call load-connected-systems that will trigger its call as soon as it's able, i.e., immediately once both "B" and "C" are loaded. I'm not familiar with the internals of ASDF and wonder if someone can guide me to a good place to define this.
You can't really do this. ASDF creates a build plan and then executes it.
To do what you want, you would have to somehow inject code into the build planning process, somehow creating a dependency that would recognize when either "B" or "C" is to be loaded, then add an OP that will load "A" iff both "B" and "C" are present, but not when only one of them is present. This will be quite difficult.
To be blunt, A-S-C is something that should be allowed to die. I have ripped it out of every ASDF system my company uses, or that I use for personal purposes. It would be more appropriate to look for solutions that avoid the need for A-S-C, instead of trying to keep it going.
If I understand your description correctly, A-S-C creates *forward* dependencies (when you build B or C you create a new dependency backward from A, or something kinda crazy like that). What's the use case for this? IIRC the cases I've seen, they're things like if I have a graph library and I have graphviz loaded, load the graphviz api for the graph library. This would better be done by adding a cl-graph+graphviz system, or possibly using some kind of weak dependency scheme.
best, r