<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">This problem is happening because of a (common) misunderstanding about what it means to apply an operator to a parent component.</p>
<p dir="auto">If you have a parent component, P, and serial children C1, C2, C3, then a simple downward-operation O will generate this plan:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">(O . C1)
(O . C2)
(O . C3)
(O . P)
</code></pre>
<p dir="auto">So ASDF does a <em>postorder</em> traversal of the component tree which gives the results which you report (and which you do not like).</p>
<p dir="auto">To get the macros loaded at the proper time, you could do the following:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">:in-order-to ((prepare-op (load-op "some-macros")))
</code></pre>
<p dir="auto">But this will not do what you want because it will <em>always</em> load <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">some-macros</code> rather than skipping the load when the compile-op is already done.</p>
<p dir="auto">I don't believe that what you ask for can easily be done because if you try to load a system, ASDF will <em>always</em> put the <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">compile-op</code> into the plan -- but it will notice that the <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">compile-op</code> is <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">already-done-p</code>, and not <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">perform</code> the operation.</p>
<p dir="auto">If you really want to do this, you should probably set up your own compile-op like operation that will be done in a separate phase, and for which you can make your own rules (like the way one can translate protobuf specifications with an external compiler).</p>
<p dir="auto">On 21 Jun 2021, at 7:57, akater wrote:</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">I tried to specify a build-time dependency for ASDF system, and failed.</p>
<p dir="auto">The defsystem option</p>
<p dir="auto">:depends-on systems</p>
<p dir="auto">makes “systems” both build-time and runtime dependencies of a system<br>
being defined. I'm interested in specifying a dependency that is<br>
required at build time only.</p>
<p dir="auto">I attempted</p>
<p dir="auto">(defsystem "test-toplevel-in-order-deps"<br>
:in-order-to ((compile-op (load-op "some-macros")))<br>
:components ((:file "a")<br>
(:file "b")))</p>
<p dir="auto">but this way, some-macros is loaded too late:</p>
<p dir="auto">(let ((system (find-system "test-toplevel-in-order-deps")))<br>
(plan-actions<br>
(make-plan 'sequential-plan 'compile-op system)))<br>
;; =></p>
<p dir="auto">((#<PREPARE-OP > . #<SYSTEM "test-toplevel-in-order-deps">)<br>
(#<PREPARE-OP > . #<CL-SOURCE-FILE "test-toplevel-in-order-deps" "a">)<br>
(#<COMPILE-OP > . #<CL-SOURCE-FILE "test-toplevel-in-order-deps" "a">)<br>
(#<PREPARE-OP > . #<CL-SOURCE-FILE "test-toplevel-in-order-deps" "b">)<br>
(#<COMPILE-OP > . #<CL-SOURCE-FILE "test-toplevel-in-order-deps" "b">)<br>
(#<PREPARE-OP > . #<SYSTEM "some-macros">)<br>
...<br>
(#<LOAD-OP > . #<SYSTEM "some-macros">)<br>
(#<COMPILE-OP > . #<SYSTEM "test-toplevel-in-order-deps">))</p>
<p dir="auto">I'm not requesting a feature but still, it's unfortunate that a<br>
seemingly basic task of specifying build-time dependency is unachievable<br>
in ASDF.</p>
<p dir="auto">My hypothesis is, if (compile-op . parent) depends on “actions”, then<br>
compiling children of parent should depend on “actions” as well, and<br>
similarly for all instances of downward-operation. I'm not sure what's<br>
the best way to implement this but I wonder if you find this reasonable<br>
in the first place.</p>
</blockquote>
<p dir="auto">Robert P. Goldman<br>
Research Fellow<br>
Smart Information Flow Technologies (d/b/a SIFT, LLC)</p>
<p dir="auto">319 N. First Ave., Suite 400<br>
Minneapolis, MN 55401</p>
<p dir="auto">Voice: (612) 326-3934<br>
Email: <a href="mailto:rpgoldman@SIFT.net" style="color:#3983C4">rpgoldman@SIFT.net</a></p>
</div>
</div>
</body>
</html>