As has been discussed here over the years, asdf:*compile-file-failure-behaviour* is :warn on most platforms, but it is notoriously :error on #+sbcl. So what would you do if you wanted to change asdf:*compile-file-failure-behaviour* to be :warn on #+SBCL? How would you recommend to change it. Where?
I don't want to really have to impose an init file on everyone. Also, I don't really want to necessarily make this global across every use of ASDF, but let's say I just want it to apply to one main system and all subsystems loaded as part of this.
I cannot think of anything better than a top-level setq in the .asd file of the system, something like this?
#+sbcl (setq asdf:*compile-file-failure-behaviour* :warn)
What else can one do that's any better?
Maybe there's a less crude way, like something like an around method that wraps around the compile/load. I'm really just barely a novice user, so I'm sorry this if this is such a naive question. If there's a simple example one could provide or point me to that does this, I'd appreciate it.
Thanks,
Mark
Are you just using this for yourself? If so, a simple
``` (let ((asdf:*compile-file-failure-behaviour* :warn)) (asdf:load-system "my system")) ```
will suffice.
Alternatively, you could put something like this in the `.asd` file:
``` (defmethod operate :around ((operation load-op) (system (asdf:find-system "my-system"))) (let ((asdf:*compile-file-failure-behaviour* :warn)) (call-next-method))) ```
The above most emphatically *has not been tested*, so it might be wrong.
I *think* if the top-level operation you use is `load-op`, this should work. Alternatively, you might want to replace `(operation load-op)` with just `(operation operation)` (and add a `(declare (ignorable operation))`)
Cheers, r
On 9 Mar 2018, at 16:12, Mark H. David wrote:
As has been discussed here over the years, asdf:*compile-file-failure-behaviour* is :warn on most platforms, but it is notoriously :error on #+sbcl. So what would you do if you wanted to change asdf:*compile-file-failure-behaviour* to be :warn on #+SBCL? How would you recommend to change it. Where?
I don't want to really have to impose an init file on everyone. Also, I don't really want to necessarily make this global across every use of ASDF, but let's say I just want it to apply to one main system and all subsystems loaded as part of this.
I cannot think of anything better than a top-level setq in the .asd file of the system, something like this?
#+sbcl (setq asdf:*compile-file-failure-behaviour* :warn)
What else can one do that's any better?
Maybe there's a less crude way, like something like an around method that wraps around the compile/load. I'm really just barely a novice user, so I'm sorry this if this is such a naive question. If there's a simple example one could provide or point me to that does this, I'd appreciate it.
Thanks,
Mark
No, it's what we want for our system. We want everyone who builds our system to get this behavior reliably.
----- Original message ----- From: Robert Goldman rpgoldman@sift.info To: "Mark H. David" mhd@yv.org Cc: "ASDF-devel" asdf-devel@common-lisp.net Subject: Re: Best Practice for an ASDF Variable Like **compile-file-failure-behaviour**Date: Fri, 09 Mar 2018 16:34:48 -0600
Are you just using this for yourself? If so, a simple
(let ((asdf:*compile-file-failure-behaviour* :warn)) (asdf:load-system "my system"))will suffice.
Alternatively, you could put something like this in the .asd file:
(defmethod operate :around ((operation load-op) (system (asdf:find- system "my-system"))) (let ((asdf:*compile-file-failure-behaviour* :warn)) (call-next-method)))The above most emphatically *has not been tested*, so it might be wrong.I *think* if the top-level operation you use is load-op, this should work. Alternatively, you might want to replace (operation load-op) with just (operation operation) (and add a (declare (ignorable operation)))Cheers, r
On 9 Mar 2018, at 16:12, Mark H. David wrote:
As has been discussed here over the years, asdf:*compile-file-failure- behaviour* is :warn on most platforms, but it is notoriously :error on #+sbcl. So what would you do if you wanted to change asdf:*compile-file-failure- behaviour* to be :warn on #+SBCL? How would you recommend to change it. Where?> I don't want to really have to impose an init file on everyone. Also, I don't really want to necessarily make this global across every use of ASDF, but let's say I just want it to apply to one main system and all subsystems loaded as part of this.> I cannot think of anything better than a top-level setq in the .asd file of the system, something like this?> #+sbcl (setq asdf:*compile-file-failure-behaviour* :warn)
What else can one do that's any better?
Maybe there's a less crude way, like something like an around method that wraps around the compile/load. I'm really just barely a novice user, so I'm sorry this if this is such a naive question. If there's a simple example one could provide or point me to that does this, I'd appreciate it.> Thanks,
Mark
OK, then I believe that defining the method for `OPERATE` will give you what you want. You can put that definition in `my-system.asd` below the `defsystem` for "my-system". There's only one problem with that -- if you `load-system` on "my-system" before `my-system.asd` has been loaded (e.g., by `find-system`), then you will lose, because the around method will not have been defined before the first call to `operate`.
On 9 Mar 2018, at 16:37, Mark H. David wrote:
No, it's what we want for our system. We want everyone who builds our system to get this behavior reliably.
----- Original message ----- From: Robert Goldman rpgoldman@sift.info To: "Mark H. David" mhd@yv.org Cc: "ASDF-devel" asdf-devel@common-lisp.net Subject: Re: Best Practice for an ASDF Variable Like **compile-file-failure-behaviour**Date: Fri, 09 Mar 2018 16:34:48 -0600
Are you just using this for yourself? If so, a simple
(let ((asdf:*compile-file-failure-behaviour* :warn)) (asdf:load-system "my system"))will suffice.
Alternatively, you could put something like this in the .asd file:
(defmethod operate :around ((operation load-op) (system (asdf:find- system "my-system"))) (let ((asdf:*compile-file-failure-behaviour* :warn)) (call-next-method)))The above most emphatically *has not been tested*, so it might be wrong.I *think* if the top-level operation you use is load-op, this should work. Alternatively, you might want to replace (operation load-op) with just (operation operation) (and add a (declare (ignorable operation)))Cheers, r
On 9 Mar 2018, at 16:12, Mark H. David wrote:
As has been discussed here over the years, asdf:*compile-file-failure- behaviour* is :warn on most platforms, but it is notoriously :error on #+sbcl. So what would you do if you wanted to change asdf:*compile-file-failure- behaviour* to be :warn on #+SBCL? How would you recommend to change it. Where?> I don't want to really have to impose an init file on everyone. Also, I don't really want to necessarily make this global across every use of ASDF, but let's say I just want it to apply to one main system and all subsystems loaded as part of this.> I cannot think of anything better than a top-level setq in the .asd file of the system, something like this?> #+sbcl (setq asdf:*compile-file-failure-behaviour* :warn)
What else can one do that's any better?
Maybe there's a less crude way, like something like an around method that wraps around the compile/load. I'm really just barely a novice user, so I'm sorry this if this is such a naive question. If there's a simple example one could provide or point me to that does this, I'd appreciate it.> Thanks,
Mark
On Fri, Mar 9, 2018 at 5:34 PM, Robert Goldman rpgoldman@sift.info wrote:
Are you just using this for yourself? If so, a simple
(let ((asdf:*compile-file-failure-behaviour* :warn)) (asdf:load-system "my system"))
will suffice.
Yup.
Alternatively, you could put something like this in the .asd file:
(defmethod operate :around ((operation load-op) (system (asdf:find-system "my-system"))) (let ((asdf:*compile-file-failure-behaviour* :warn)) (call-next-method)))
The above most emphatically has not been tested, so it might be wrong.
As a rule of thumb, you should never define :around methods for operate, for they do NOT do what you might naively believe they do: 1- they are only called on the top-level system, and/or on systems loaded directly by a defsystem-depends-on 2- they wrap around not just the system at hand, but all its transitive dependencies.
The working approach to changing variables for a system, no more no less, is an :around-compile hook for your system.
But the correct approach is to NOT modify asdf:*compile-file-failure-behaviour* but instead to catch specifically the warnings that you want to ignore, using *uninteresting-conditions* and the with-muffled-compiler-conditions implicit in compile-file* and thus perform compile-op. See notably the variable *usual-uninteresting-conditions*.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Intentions are not so much direct descriptions of actual mind processes as Schelling points in the way social animals communicate.
On 9 Mar 2018, at 17:02, Faré wrote:
On Fri, Mar 9, 2018 at 5:34 PM, Robert Goldman rpgoldman@sift.info wrote:
Are you just using this for yourself? If so, a simple
(let ((asdf:*compile-file-failure-behaviour* :warn)) (asdf:load-system "my system"))
will suffice.
Yup.
Alternatively, you could put something like this in the .asd file:
(defmethod operate :around ((operation load-op) (system (asdf:find-system "my-system"))) (let ((asdf:*compile-file-failure-behaviour* :warn)) (call-next-method)))
The above most emphatically has not been tested, so it might be wrong.
As a rule of thumb, you should never define :around methods for operate, for they do NOT do what you might naively believe they do: 1- they are only called on the top-level system, and/or on systems loaded directly by a defsystem-depends-on 2- they wrap around not just the system at hand, but all its transitive dependencies.
The working approach to changing variables for a system, no more no less, is an :around-compile hook for your system.
But the correct approach is to NOT modify asdf:*compile-file-failure-behaviour* but instead to catch specifically the warnings that you want to ignore, using *uninteresting-conditions* and the with-muffled-compiler-conditions implicit in compile-file* and thus perform compile-op. See notably the variable *usual-uninteresting-conditions*.
This is a very good point. What the OP asks for is actually the thing that you (I believe correctly) say they should not want: "...wrap around not just the system at hand, but all its transitive dependencies."
That's hard to do in a generally reliable way, because the author of the system definition has no way to tell whether the
In general, it's a Bad Idea to ignore warnings in this way. Almost always the warnings you ignore will eventually come back to bite you. Even if they do not do so directly, the next time you introduce a bug that causes a warning, you won't see it because ASDF is not breaking when it should.
Not just in CL, but *everywhere*, it's good practice to require your systems to build cleanly, without warnings.
In fact, I'd say the only time when you want to ignore warnings is when you have someone else's library, they have done something that is wrong, but that you know will not cause an error, and you don't have a good way to get the upstream system fixed. In that case, as Faré says, the right thing is to wrap *only that system* in a targeted muffling of warnings.
So, I think my around method solution is what you asked for, but Faré is right: you should think very hard about whether what you asked for is actually what you need.
Cheers, r
Actually, I see these lines in the file asdf.lisp in my sbcl distribution (SBCL 1.4):
(defmethod operate :around (operation component &rest keys &key verbose (on-warnings *compile-file-warnings- behaviour*)> (on-failure *compile-file-failure- behaviour*))
Could someone please ELI5 how to hook into that for on-failure?
Thanks,
Mark
----- Original message ----- From: Robert Goldman rpgoldman@sift.info To: "Mark H. David" mhd@yv.org Cc: "ASDF-devel" asdf-devel@common-lisp.net Subject: Re: Best Practice for an ASDF Variable Like **compile-file-failure-behaviour**Date: Fri, 09 Mar 2018 16:34:48 -0600
Are you just using this for yourself? If so, a simple
(let ((asdf:*compile-file-failure-behaviour* :warn)) (asdf:load-system "my system"))will suffice.
Alternatively, you could put something like this in the .asd file:
(defmethod operate :around ((operation load-op) (system (asdf:find- system "my-system"))) (let ((asdf:*compile-file-failure-behaviour* :warn)) (call-next-method)))The above most emphatically *has not been tested*, so it might be wrong.I *think* if the top-level operation you use is load-op, this should work. Alternatively, you might want to replace (operation load-op) with just (operation operation) (and add a (declare (ignorable operation)))Cheers, r
On 9 Mar 2018, at 16:12, Mark H. David wrote:
As has been discussed here over the years, asdf:*compile-file-failure- behaviour* is :warn on most platforms, but it is notoriously :error on #+sbcl. So what would you do if you wanted to change asdf:*compile-file-failure- behaviour* to be :warn on #+SBCL? How would you recommend to change it. Where?> I don't want to really have to impose an init file on everyone. Also, I don't really want to necessarily make this global across every use of ASDF, but let's say I just want it to apply to one main system and all subsystems loaded as part of this.> I cannot think of anything better than a top-level setq in the .asd file of the system, something like this?> #+sbcl (setq asdf:*compile-file-failure-behaviour* :warn)
What else can one do that's any better?
Maybe there's a less crude way, like something like an around method that wraps around the compile/load. I'm really just barely a novice user, so I'm sorry this if this is such a naive question. If there's a simple example one could provide or point me to that does this, I'd appreciate it.> Thanks,
Mark
On Fri, Mar 9, 2018 at 7:32 PM, Mark H. David mhd@yv.org wrote:
Actually, I see these lines in the file asdf.lisp in my sbcl distribution (SBCL 1.4):
(defmethod operate :around (operation component &rest keys &key verbose (on-warnings *compile-file-warnings-behaviour*) (on-failure *compile-file-failure-behaviour*))
Could someone please ELI5 how to hook into that for on-failure?
These are there for backward compatibility with ASDF 1. You are of course free to use them, and I'm in no position to deprecate anything anymore. But that's not what I would recommend as best practice.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The highest of minds / Often have built for themselves / The tallest of jails.