Re: [asdf-devel] create temporary Lisp files in fasl directory

2010-08-06 Thread Robert Brown
On Fri, Aug 6, 2010 at 1:24 AM, Stelian Ionescu sione...@cddr.org wrote:

 Try something like this:

 (defmethod asdf:perform ((op asdf:compile-op) (c protobuf-source-file))
  (let* ((output-defaults (pathname (car (asdf:output-files op c
 (generated-source-file (make-pathname :name (pathname-name
 (asdf:component-pathname c))
   :type lisp
   :defaults output-defaults)))
))

 You need to call OUTPUT-FILES which will apply the output translations
 you've configured


Your suggestion does work, but it's a bit mysterious.  Note that you didn't
redefine INPUT-FILES for components of type PROTOBUF-SOURCE-FILE
and the suggestion involves copying PERFORM code from asdf.lisp into my
protobuf.asd file.

Also, your change appears to just affect compilation, but due to ASDF's
handling of so called self dependencies (at least I think this is the
cause)
your change also magically makes LOAD-OP function correctly.

I agree with Robert Goldman that it would be nice to pin down the semantics
of INPUT-FILES and OUTPUT-FILES.  Maybe the self-dependency code
can be eliminated or made more general.  Right now I think it's a special
case just used to make LOAD-OP capable of doing two things,
compiling and then loading the compiled products.

In any case, thanks for the suggestion.  It does indeed solve my problem.

bob
___
asdf-devel mailing list
asdf-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel


Re: [asdf-devel] create temporary Lisp files in fasl directory

2010-08-06 Thread Robert Goldman
On 8/6/10 Aug 6 -11:49 AM, Robert Brown wrote:
 On Fri, Aug 6, 2010 at 1:24 AM, Stelian Ionescu sione...@cddr.org
 mailto:sione...@cddr.org wrote:
 
 Try something like this:
 
 (defmethod asdf:perform ((op asdf:compile-op) (c protobuf-source-file))
  (let* ((output-defaults (pathname (car (asdf:output-files op c
 (generated-source-file (make-pathname :name (pathname-name
 (asdf:component-pathname c))
   :type lisp
   :defaults
 output-defaults)))
))
 
 You need to call OUTPUT-FILES which will apply the output
 translations you've configured

This example suggests a possible improvement to the API to avoid
problems down the road.

I'd suggest we add a new exported function, ASDF:OUTPUT-FILE (singular),
which has the same signature as ASDF:OUTPUT-FILES.

ASDF:OUTPUT-FILE should return the first element of the list returned by
ASDF:OUTPUT-FILES, if this list is of length 1.  If ASDF:OUTPUT-FILES
returns a list of length != 1, ASDF:OUTPUT-FILE should raise an error.

This is for people who are writing some code that is correct under the
assumption that there will be only a single output-file.  I bet a lot of
people call (first (asdf:output-files ...)), effectively just hoping
that no one went around behind their backs and changed the number of
output files.

best,
r

___
asdf-devel mailing list
asdf-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel