[Asdf-devel] Semantics of asdf:system-relative-pathname

Robert Goldman rpgoldman at sift.net
Thu Sep 4 18:58:14 UTC 2014


Faré wrote:
> On Thu, Sep 4, 2014 at 9:49 AM, Ralf Mattes <rm at mh-freiburg.de> wrote:
>> Hello list,
>>
>> I just stumbled overthe following strangeness [1]:
>>
>>  I've some code in directory foo that contains two asdf files, foo.asd
>>  and foo-test.asd, the later contains the following definition:
>>
>>   (defsystem "foo-test"
>>      :version "0.1"
>>      :pathname "t"
>>      :serial t
>>      ..... )
>>
>>  Now, if I evaluate
>>
>>    (asdf:system-relative-pathname :foo-test "baz" :type "rsc")
>>
>>  I get a pathname relative to the _asdf-file_, while evaluating:
>>
>>    (merge-pathnames "baz.rsc" (slot-value (asdf:find-system :foo-test) 'asdf::absolute-pathname))
>>
>>  yields the correct/expected pathname (i.e. one that honors the pathname
>>  spec. of the asdf system).
>>
>>  Is this really intended behavior or just an oversight?
>>
>>   Cheers, Ralf Mattes
>>
>>  Footnotes:
>> [1]  in the sense of not following the principle o fleast astonishment
>>
> To put it in more "canonical" terms, the issue is that
> 
> (asdf:system-source-directory (asdf:find-system "foo-test")) ;=>
> #p"/home/ralf/src/foo/"
> (asdf:component-pathname (asdf:find-system "foo-test")) ;=>
> #p"/home/ralf/src/foo/t/"
> 
> Is it the right thing? Should system-relative-pathname use the latter
> rather than the former?
> I can't say. I don't want to think about these things anymore.
> The difference, if it persists, should be documented.

IMO, there is no *perfect* solution to this problem, and the current
behavior is "as right as possible."

this just shows that the top-level use of :pathname (instead of using a
module) is problematic.

On the one hand, it's clear that the programmer doesn't want any files
to live in the top level of the system: the programmer wants the top
level to have only the asdf file and maybe some READMEs, and make them
more visible by pushing the sources into a subtree.  According to this
argument, your interpretation is correct.

OTOH, what if you have a top level foo/ directory with the asdf system
definition and subdirectories src/ and data/?  In that case, you want
ASDF:SYSTEM-RELATIVE-PATHNAME to be foo/ so that you have the choice of
going to src/ or data/.

In my opinion, what this disagreement shows is that top-level (i.e., at
DEFSYSTEM) use of :PATHNAME is to be deprecated.

If my system was

(defsystem foo
  :components ((:module "src" ...)
               (:module "data" ...)))

then the current behavior would be unambiguously correct.

I think what this shows is that using :pathname at the root of a system
definition is just wrong.  Or, perhaps, that using :pathname at the root
of the system should be interpreted (i.e., its semantics should be
defined) "as if" it was defining an anonymous module (since that's what
happens -- the :pathname doesn't affect the location of the :defsystem).

I will wait for further discussion, but IMO, this is a WONTFIX.

Best,
r







-- 
Robert P. Goldman
Staff Scientist
Smart Information Flow Technologies (d/b/a SIFT, LLC)

319 1st Ave N., Suite 400
Minneapolis, MN 55401

Voice:    (612) 326-3934
Email:    rpgoldman at SIFT.net





More information about the asdf-devel mailing list