[asdf-devel] Loading an .asd file directly using its pathname

Hello, Given a pathname to an .asd file, I sometimes load it using this hack: (defun load-asd (path &rest options) (let ((asdf:*system-definition-search-functions* (cons (lambda (system) (when (string= (asdf::coerce-name system) (pathname-name path)) path)) asdf:*system-definition-search-functions*))) (apply #'asdf:load-system (pathname-name path) options))) Other times I use: (let ((asdf:*central-registry* (cons <directory-where-my-asd-lives> asdf:*central-registry*))) (asdf:load-system :some-system)) Also, I see that the slime-asdf contrib uses this definition: (defun load-asd (pathname &key name &allow-other-keys) (asdf::load-sysdef (or name (string-downcase (pathname-name pathname))) pathname)) I wonder if ASDF could export LOAD-SYSDEF or perhaps have ASDF:LOAD-SYSTEM accept a pathname in addition to what it currently accepts. Cheers, -- Luís Oliveira http://kerno.org/~luis/

Dear Luís, On Mon, Jun 24, 2013 at 1:11 PM, Luís Oliveira <luismbo@gmail.com> wrote:
Given a pathname to an .asd file, I sometimes load it using this hack:
(defun load-asd (path &rest options) (let ((asdf:*system-definition-search-functions* (cons (lambda (system) (when (string= (asdf::coerce-name system) (pathname-name path)) path)) asdf:*system-definition-search-functions*))) (apply #'asdf:load-system (pathname-name path) options)))
Other times I use:
(let ((asdf:*central-registry* (cons <directory-where-my-asd-lives> asdf:*central-registry*))) (asdf:load-system :some-system))
Also, I see that the slime-asdf contrib uses this definition:
(defun load-asd (pathname &key name &allow-other-keys) (asdf::load-sysdef (or name (string-downcase (pathname-name pathname))) pathname))
In ASDF 3, there is already a function ASDF/FIND-SYSTEM:LOAD-ASD, aka ASDF::LOAD-ASD, that is being reimplemented by slime-asdf when not present. I suppose it could be usefully exported from the ASDF/INTERFACE package. I will leave that to the new maintainer, Robert Goldman.
I wonder if ASDF could export LOAD-SYSDEF or perhaps have ASDF:LOAD-SYSTEM accept a pathname in addition to what it currently accepts.
The ASDF::LOAD-SYSDEF is obsolete. Please use ASDF::LOAD-ASD instead, at least, if you can afford to use either ASDF3 or SLIME. —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Between what I think, what I try to say, what I think I say, what I actually say, what you want to hear, what you hear, what you think you understand, what you want to understand and what you do understand, there are at least nine ways to not understand each other.

On Tue, Jun 25, 2013 at 1:44 PM, Faré <fahree@gmail.com> wrote:
In ASDF 3, there is already a function ASDF/FIND-SYSTEM:LOAD-ASD
Oh, cool! Thanks!
I suppose it could be usefully exported from the ASDF/INTERFACE package. I will leave that to the new maintainer, Robert Goldman.
FWIW, I think it's somewhat useful, yes. Cheers, -- Luís Oliveira http://kerno.org/~luis/

Luís Oliveira wrote:
On Tue, Jun 25, 2013 at 1:44 PM, Faré wrote:
In ASDF 3, there is already a function ASDF/FIND-SYSTEM:LOAD-ASD Oh, cool! Thanks!
I suppose it could be usefully exported from the ASDF/INTERFACE package. I will leave that to the new maintainer, Robert Goldman. FWIW, I think it's somewhat useful, yes.
I will certainly see about exporting it in the next release. Follow-up question: should we be checking to make sure that .asd files are /only/ loaded in the proper context? I.e., should we do something like issue a warning if one tries to load a DEFSYSTEM form when /not/ using this function? Cheers, r

Robert Goldman <rpgoldman@sift.info> writes:
Follow-up question: should we be checking to make sure that .asd files are /only/ loaded in the proper context? I.e., should we do something like issue a warning if one tries to load a DEFSYSTEM form when /not/ using this function?
I'm not sure what can go wrong if one CL:LOADs an .asd file, but if things can go wrong, a warning seems sensible, maybe even an error. Luís

On Tue, Jun 25, 2013 at 11:31 AM, Luís Oliveira <luismbo@gmail.com> wrote:
I'm not sure what can go wrong if one CL:LOADs an .asd file, but if things can go wrong, a warning seems sensible, maybe even an error.
Well, first, it might be loaded from the wrong package. ASDF 1&2 loads from a temporary package that uses CL and ASDF. ASDF 3 loads from ASDF-USER, that uses CL, ASDF, and most of POIU (not all of it, for backward-compatibility reasons, until SBCL has stopped using SB-EXT in SB-GROVEL at the same time as). —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org You only have power over people as long as you don't take everything away from them. But when you've robbed a man of everything he's no longer in your power — he's free again. — Alexander Solzhenitsyn

I didn't understand this. So are we likely to encounter problems with old systems making their own packages that use only ASDF and CL? Presumably not, unless symbols moved from ASDF to POIU, but thought I would check. "Faré" <fahree@gmail.com> wrote:
On Tue, Jun 25, 2013 at 11:31 AM, Luís Oliveira <luismbo@gmail.com> wrote:
I'm not sure what can go wrong if one CL:LOADs an .asd file, but if things can go wrong, a warning seems sensible, maybe even an error.
Well, first, it might be loaded from the wrong package. ASDF 1&2 loads from a temporary package that uses CL and ASDF. ASDF 3 loads from ASDF-USER, that uses CL, ASDF, and most of POIU (not all of it, for backward-compatibility reasons, until SBCL has stopped using SB-EXT in SB-GROVEL at the same time as).
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org You only have power over people as long as you don't take everything away from them. But when you've robbed a man of everything he's no longer in your power — he's free again. — Alexander Solzhenitsyn
-- Sent from my Android phone with K-9 Mail. Please excuse my brevity.

On Tue, Jun 25, 2013 at 11:31 AM, Luís Oliveira <luismbo@gmail.com> wrote:
I'm not sure what can go wrong if one CL:LOADs an .asd file, but if things can go wrong, a warning seems sensible, maybe even an error.
"Faré" <fahree@gmail.com> wrote:
Well, first, it might be loaded from the wrong package. ASDF 1&2 loads from a temporary package that uses CL and ASDF. ASDF 3 loads from ASDF-USER, that uses CL, ASDF, and most of POIU (not all of it, for backward-compatibility reasons, until SBCL has stopped using SB-EXT in SB-GROVEL at the same time as).
On Tue, Jun 25, 2013 at 1:21 PM, <rpgoldman@sift.info> wrote:
I didn't understand this. So are we likely to encounter problems with old systems making their own packages that use only ASDF and CL?
Presumably not, unless symbols moved from ASDF to POIU, but thought I would check.
Well, you'd have to do a run with cl-test-grid to be sure that works, but yes, it might be nice if ASDF-USER were to use all of POIU instead of just asdf/common-lisp and asdf/package. —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Quis custodiet ipsos custodes? (Who shall watch the watchmen themselves?) — Juvenal, Satires, VI, 347

On Tue, 2013-06-25 at 09:57 -0500, Robert Goldman wrote:
Luís Oliveira wrote:
On Tue, Jun 25, 2013 at 1:44 PM, Faré wrote:
In ASDF 3, there is already a function ASDF/FIND-SYSTEM:LOAD-ASD Oh, cool! Thanks!
I suppose it could be usefully exported from the ASDF/INTERFACE package. I will leave that to the new maintainer, Robert Goldman. FWIW, I think it's somewhat useful, yes.
I will certainly see about exporting it in the next release.
Follow-up question: should we be checking to make sure that .asd files are /only/ loaded in the proper context? I.e., should we do something like issue a warning if one tries to load a DEFSYSTEM form when /not/ using this function?
Yes. -- Stelian Ionescu a.k.a. fe[nl]ix Quidquid latine dictum sit, altum videtur. http://common-lisp.net/project/iolib

On Tue, Jun 25, 2013 at 11:28 AM, Stelian Ionescu <sionescu@cddr.org> wrote:
On Tue, 2013-06-25 at 09:57 -0500, Robert Goldman wrote:
Luís Oliveira wrote:
On Tue, Jun 25, 2013 at 1:44 PM, Faré wrote:
In ASDF 3, there is already a function ASDF/FIND-SYSTEM:LOAD-ASD Oh, cool! Thanks!
I suppose it could be usefully exported from the ASDF/INTERFACE package. I will leave that to the new maintainer, Robert Goldman. FWIW, I think it's somewhat useful, yes.
I will certainly see about exporting it in the next release.
Follow-up question: should we be checking to make sure that .asd files are /only/ loaded in the proper context? I.e., should we do something like issue a warning if one tries to load a DEFSYSTEM form when /not/ using this function?
Yes.
Sounds like a good default, as long as there's a way to explicitly setup a proper environment for a defsystem to be used without a load-asd, which is sometimes quite useful, to create "dummy" systems, etc. Such functionality is used not just by the asdf tests themselves, but also by some large application that I have worked on. —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Anyone who says he can see through women is missing a lot. — Groucho Marx
participants (5)
-
Faré
-
Luís Oliveira
-
Robert Goldman
-
rpgoldman@sift.info
-
Stelian Ionescu