*LOAD-TRUENAME* and ASDF

Lucien Pullen drurowin at gmail.com
Wed Aug 24 21:54:25 UTC 2016


Also sprach Robert Goldman on 2016-08-24:
> I just realized that ASDF somewhat breaks *LOAD-TRUENAME*.
>
> I had some code in a DSL that has an :INCLUDE construct, and that DSL is
> being interpreted at load-time.
>
> The :INCLUDE directive tries to find other lisp files relative to the
> current file (the source file that contained the DSL :INCLUDE expression).
>
> Now, if we were not using ASDF, I would be able to find those files by
> merging a name with *load-truename* (and this is how things used to work).
>
> But ASDF's relocation of the fasls breaks this.

I've identified two problems from this.

> I somehow assumed it would be possible to go from the FASL to the
> source, but I don't actually see any obvious way to do this.

I've been using the :STATIC-FILE component type to include the
to-be-loaded file with the system.  Then I just use LOAD like normal.
I've been using ASDF with image dumping, so finding the source file
probably wouldn't work.

This isn't quite ideal because ASDF doesn't perform compilation of
:STATIC-FILE.  I noticed there's an experimental option
:BUILD-OPERATION, but it is wholly undescribed apart from saying the
default is to load the compiled file into the system.  Since it's
already there, we should standardize some more of it, such as to compile
but not load the component.

(This won't work in all situations, but for files that can be compiled
it should help.)

> 2. It is poor software engineering, because it requires the contained
> thing (the DSL expression) to "know" that it is being included in a very
> specific ASDF system.  Now if we rename the ASDF system, or shuffle
> files, our DSL code is broken, and that's just wrong, because it makes
> the abstraction upside down.

There is no dynamic binding for the current system (or component), like
*PACKAGE* and *LOAD-TRUENAME*.  If ASDF calls COMPILE-FILE anyways,
couldn't we bind ASDF:*SYSTEM* (the currently compiled system) around
it?

When the containing form is compiled using ASDF it points to the current
system so you can use ASDF:FIND-COMPONENT with it.  When it isn't, you
fall back on *LOAD-TRUENAME* and attach the correct file type to the
component name.



More information about the asdf-devel mailing list