On 4 Aug 2020, at 17:00, Ilya Perminov wrote:

I think there is a problem with the :around method approach  - it is
not safe for an ASDF extension to define methods on ASDF's
operations/components, because other ASDF extensions may want to do
the same thing. Imagine there is CFFI* and I want to use both CFFI and
CFFI*.

That is true -- that's why I always try to have either my own operation class or my own component class, or both. So to do this, you would want to have your own subclass of `system` that you wish to have work this way (e.g., `cffi-extended-system`) -- you generally do not want to add methods to the standard classes in ASDF, both because of potential collisions, and because you don't know what else they might interfere with.

On Tue, Aug 4, 2020 at 2:35 PM Robert Goldman <rpgold...@gmail.com> wrote:

On 4 Aug 2020, at 16:18, Ilya Perminov wrote:

The around method will look something like this

(defmethod input-files :around ((o asdf/bundle::gather-operation) (c system))
  (unless (eq (asdf/bundle::bundle-type o) :no-output-file)
    (append (call-next-method)
            (remove-if-not
                (asdf/bundle::pathname-type-equal-function
(asdf/bundle::bundle-pathname-type (asdf/bundle::gather-type o))) (mappend (lambda (c) (output-files 'process-op c)) (asdf/component:sub-components c :type 'wrapper-file))))))

To my taste it knows too much about ASDF guts, but maybe it is not too bad.

I'm looking at the code now, and

bundle-type is exported from asdf/bundle (but not asdf) (it could use a docstring if you can propose one)

So is bundle-pathname-type

pathname-type-equal-function is not exported, but it's a trivial combination of pathname-type and equalp

gather-type is the only "really internal" function. (A block comment would be nice here, too.)

gather-operation is not exported, but I think that's probably wrong on our part: I don't believe there should be hidden operations. If I get around to it, I will probably export it from the asdf (really asdf/interface) package, unless someone has a good argument for it continuing to be internal.

So I don't think that is a lot of ASDF internals, especially not for customizing the ASDF protocol.

Reply via email to