:FEATURE dependency-def
Faré
fahree at gmail.com
Tue May 17 18:25:20 UTC 2016
>>: Faré
>: Robert
>> I strongly recommend against erroring in the .asd file itself based on
>> the implementation, because that hinders cross-compilation.
>
> IIUC what this boils down to is a preference for failing to *operate* on
> the system, rather than failing to parse the system definition. Correct?
>
If we ever want to support cross-compilation, it's more than a
preference: it's a bug to fail to load an .asd file just because the
system won't load on the current (master) implementation — it is meant
to work on the (slave) cross-implementation.
> [As an aside, there may be a separate bug: when I tried to load DecLt
> into ACL, the loading *succeeded*, but the contents of the decLt "core"
> subsystem failed to be loaded. So I believe there may be an oddity in
> the way ASDF is handling these "failed" :feature dependencies. I will
> try to replicate and provide a minimal test case.]
>
I'd say it's a bug in DecLt rather than ASDF.
It's :if-feature :sbcl says that the system is a NOP
when the target implementation isn't sbcl.
If what is intended instead is that the system should
error out when the implementation isn't sbcl,
it should use something like
:depends-on (... (:feature (:not :sbcl) "implementation-not-supported") ...)
or to be cleaner:
:components ((:file "implementation-not-supported" :if-feature (:not :sbcl)))
>> The traditional solution is to load a file that fails.
>> i.e. create a file unsupported-implementation.lisp that
>> has an (error ...) form and in your asd file, use a component
>> (:file "unsupported-implementation" :if-feature (:not :sbcl))
>
> I would prefer that we provide a more readable version of this. I think
> we could readily add
>
> (:depends-on (:essential-feature :sbcl))
>
I don't like that name, and I don't like abusing :depends-on for it.
If you want an error when compiling outside a given set of
implementations, maybe it's better having a defsystem option. it
doesn't make sense at the component level, so let's not hack the
depends-on language for it.
(defsystem declt ... :error-if-not-feature :sbcl ...)
:(fail|error)-(if-not|unless)(|-feature)
:only-build-(on|with-feature)
:demand-feature
> As I said earlier, the "bogus file" solution seems to me unpleasantly
> indirect, because then the poor reader must grovel over
> "unsupported-implementation" to see what will happen if one tries to
> load it, when the intent is simply to say "this won't work unless you
> are on SBCL."
>
That's quite a reasonable feature request.
I was only describing the current "best practice".
> I believe we could provide this with the semantics you propose (fail on
> operation, not on loading the system definition).
>
You could fail while building the plan, rather than performing it.
Building a plan is already feature-dependent.
That would save users a lot of patiently waiting for dependencies to
build until they get their doomed answer.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Live as if you were living already for the second time and
as if you had acted the first time as wrongly as you are about to act now!
— Viktor Frankl, "Man's Search for Meaning"
More information about the asdf-devel
mailing list