[asdf-devel] dependency bug?
Robert Goldman
rpgoldman at sift.info
Mon Jan 25 20:15:20 UTC 2010
On 1/25/10 Jan 25 -1:58 PM, Robert Brown wrote:
> Thanks again for responding to my questions. I've interleaved
> a few comments below.
>
> On 1/23/10, Robert Goldman <rpgoldman at sift.info> wrote:
>> On 1/23/10 Jan 23 -1:13 PM, Robert Brown wrote:
>>> Protocol description files (suffix .proto) need to be converted
>>> into Lisp source, which is then compiled and loaded. I'm trying
>>> to get the dependencies right in one of my COMPONENT-DEPENDS-ON
>>> methods.
>
>> I may be able to help with this --- I have some examples of cases where
>> I have written preprocessors that turn some outside languages into lisp
>> through preprocessing.
>
> I believe I have something that works, but it's a bit suboptimal. For each
> proto file I have 2 components, one that converts the proto file into a Lisp
> source file, and a second that compiles and loads the Lisp code. It would
> be nice to combine these two components into just one ASDF component.
I wrote an ASDF operation that took the output of the Protege ontology
GUI and pushed it through a colleague's perl script to yield lisp output
that ASDF then compiles and loads.
I did this by adding a new type of component that's a subclass of
cl-source-file and adding a new operation that must be done before doing
the compile-op. That new operation finds the /real/ source file and
pushes it through the perl script...
This last aspect is a little undesirable --- it would probably be better
if the code was written so that you specify the real source file, and we
were to compute the input-files for the lisp from that. But that would
have required more new code writing...
Here are some snippets. If you correct/improve them, please share it,
and maybe we can turn this into a howto:
;;; need to add methods that will handle the making of this from the protege
;;; ontology input file. [2008/09/23:rpg]
(defclass pont-file (cl-source-file)
()
(:documentation "This is an ontology file that must be built from a
protege
ontology output file.")
)
(defclass pont-to-lisp (operation)
()
(:documentation "The process of translating a Protege ontology to
a lisp source file, performed by a perl script.")
)
(defmethod component-depends-on ((op compile-op) (c pont-file))
(append (call-next-method) `((pont-to-lisp ,(component-name c)))))
(defmethod output-files ((op pont-to-lisp) (c pont-file))
;; this is my shorthand
;; way of saying that the process of doing pont-to-lisp on a pont-filename
;; should yield this lisp filename... [2008/09/24:rpg]
(list (component-pathname c)))
;;; there's a horrible method for input-files on pont-to-lisp X
;;; pont-file which I will spare you to save myself embarrassment
(defmethod perform ((op pont-to-lisp) (c pont-file))
(asdf:run-shell-command "perl ~a ~a > ~a"
*ptolisp* (namestring (first (input-files op c)))
(namestring (first (output-files op c)))))
This seems to mostly work, but I've never been confident that it is the
right thing.
>
>
....
>
>> Have you tried looking at component-do-first as well as in-order-to?
>
> I think I see what's going on now. In addition to the IN-ORDER-TO
> dependencies, ASDF records an additional dependency in the DO-FIRST
> slot. When :depends-on is specified, the DO-FIRST slot is set:
>
> (setf (slot-value ret 'do-first) `((compile-op (load-op , at depends-on))))
>
> This is strange to me. Why put dependencies in two different places?
> The DO-FIRST dependency cannot be supplied by providing a new
> implementation of the COMPONENT-DEPENDS-ON method. It's
> only set when :depends-on is used in the system definition.
>
> I'm unfamiliar with ASDF internals, but I think the semantics of ASDF
> dependencies would be more straightforward if DO-FIRST were removed and
> IN-ORDER-TO used for all dependencies.
I wish I could tell you --- I don't see any comments here. I presume
that there's some good reason for this having been added, but I don't
know what it would be.
I wonder if it's a method-combination thing --- like the way that some
functions were forced into standard method combination because CLISP
once upon a time didn't have PROGN, AND, APPEND, etc.
Maybe Dan Barlow or somebody will see this and comment...
Sorry I can't be more helpful.
best,
r
More information about the asdf-devel
mailing list