follow-up about handling .info file and index
Faré
fahree at gmail.com
Wed Mar 21 02:30:06 UTC 2018
Dear Robert and Robert,
here is a complement to Robert Goldman's excellent response.
It includes some style hints for the future of ASDF and its extensions.
>: Robert Dodier
> What I finally settled on is this. When the operation is COMPILE-OP,
> the .info file is copied to same location where the index fasl will go
> (because the index has some code to read the .info and it assumes the
> .info is in the same place as the fasl). In the .asd file, I say
> (defsystem-depends-on "info-index") and (:info-index "foo-index") for
> the component foo-index.lisp. This seems to be working as intended.
>
If your index is just a lisp file,
why do you even need to subclass cl-source-file, to begin with?
And if you do, why do you need override any method or initform?
Let the CL source files be compiled the normal way!
As to locating the .info file, while not just use the recommended
asdf:system-relative-pathname ?
I admit ASDF doesn't have a good story for standalone software delivery,
beside "hardwire everything in the image".
However your method strikes me as worse in every respect.
For a solution that requires all libraries to use suitable abstractions,
see in quux/lisp/qres-build/pathnames.lisp in the quux snapshot tarball
(that you can find on the QITAB page)
how we used to do it at ITA Software's QRes team.
The code in asdf/uiop/configuration.lisp including XDG support
is also a good start.
Making from it a solution adopted by the Common Lisp community at large
is an exercise left to the masochist.
NB: If you're that masochist, please contact me as I'm pushing for
something broadly similar in gerbil-scheme's clan libraries;
see utils/path-config.ss for the current version,
good enough for my current application but probably not
a well-defined general solution.
> (1) In the class definition for INFO-INDEX, it
> seems to be necessary to intone (type :initform "lisp").
>
This is not necessary. You are confused. See Robert Goldman's response.
It is inherited indeed, and is defined in lisp-action.lisp as follows:
(defclass cl-source-file (source-file)
((type :initform "lisp"))
Now, my latest woes with asdf/bundle revealed that this pattern,
that I had been relying on since ASDF2,
isn't friendly with respect to code upgrade,
and particularly not friendly in case of a bug in a value
that must be fixed in a latter version.
A better pattern, that is now used for some methods
(notably gather-type and bundle-type in asdf/bundle.lisp),
is instead to define a method:
(defmethod file-type ((_ info-index)) "lisp")
I recommend you should use this pattern for all code going forward.
Except of course, you don't need to define a new method if you don't
need to override the behavior from the super-class.
However, note that this pattern is NOT currently in use
in asdf/component.lisp or asdf/lisp-action.lisp -- yet.
I would recommend that a future ASDF maintainer should in the future
replace all current occurrences of static slots :initform with this style
but that is a backward incompatible move that requires
a proper transition period:
first, announce the deprecation of the old style;
second, update all relevant ASDF extensions in Quicklisp;
third, bug known companies suspected to have private ASDF extensions;
finally, after a suitable timeout (one or two years since deprecation),
make the change in ASDF itself.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Don't worry about what anybody else is going to do. The best way to predict
the future is to invent it. Really smart people with reasonable funding can
do just about anything that doesn't violate too many of Newton's Laws!
— Alan Kay, 1971
More information about the asdf-devel
mailing list