Define a Simple Echo-Op

Robert Goldman rpgoldman at sift.net
Wed Apr 27 16:12:22 UTC 2022


On 27 Apr 2022, at 10:26, Robert Goldman wrote:

> Phoebe Goldman writes (but can't post):
>

>> I'm following the manual: "If the action of performing the operation on a component has
>> dependencies, you must define a method on component-depends-on."
>
>
> This is wrong; I don't know why the manual says that. You still can define a method on COMPONENT-DEPENDS-ON, but there's no reason to unless you have a really weird operation. Writing your own COMPONENT-DEPENDS-ON methods is error-prone and a pain in the ass, so it's much easier to subclass one of the direction-DEPENDS-ON methods and get a built-in method that does the right thing.

I will fix the manual RN.
>
>> But still I don't get why echo-op depends on itself. I didn't specify it
>> anyway. Or it that the default behaviour for all *-operation classes?
>
>
> Honestly, I have no clue why there's an (ECHO-OP . NIL) pair at the head of the COMPONENT-DEPENDS-ON list for an ECHO-OP. But MAP-DIRECT-DEPENDENCIES ignores it. Shrug.
>
>> "A method for [INPUT-FILES] is often not needed, since ASDF has a pretty
>> clever default input-files mechanism."

>
>
> Again, I don't know why the manual says that. You don't need to define INPUT-FILES methods for built-in operations, but you will need to define them for custom operations that take files as input. Most user-defined operations subclass either COMPILE-OP or LOAD-OP, which already have their INPUT-FILES (and OUTPUT-FILES) methods, but I've had to define INPUT-FILES methods in the past.


I will update that, too. TBH, I'm not sure that this is up-to-date with Fare's refactoring that introduced the `additional-input-files` generic function, but I don't have enough time today to dig into this burger.

>> Is there a way to obtain the pathname to (:FILE "foo") from the
>> CL-SOURCE-FILE object like what COMPILE-OP does?
>
>
> COMPONENT-PATHNAME.
>
>> Why do I get nothing for my input-files? I'm expecting it to print out
>> the pathname to (:FILE "foo") object, very much like the input files
>> into COMPILE-OP.
>
> Taking the COMPONENT-PATHNAME as the sole INPUT-FILE can't be the default, because lots of operations do something different. If you think of PREPARE-OP, COMPILE-OP and LOAD-OP as being the "normal" operations on a LISP-SOURCE-FILE, only COMPILE-OP takes the source file as an INPUT-FILE. LOAD-OP takes as an INPUT-FILE the compiled fasl, which is the OUTPUT-FILES of COMPILE-OP. I don't think PREPARE-OP takes any INPUT-FILES at all, but I could be wrong.

According to the docs, most operations inherit from `self ward-operation`, which would take the component-pathname as an input file (and might take others).

If this is wrong, please let me know and I will adjust the documentation.


Getting more of this discussion into the manual would be great, since there's lots of good guidance here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20220427/95d18d0c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 265 bytes
Desc: OpenPGP digital signature
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20220427/95d18d0c/attachment-0001.sig>


More information about the asdf-devel mailing list