Opened 12 years ago
Last modified 21 months ago
#242 assigned defect
Unused &key arguments in defmethod forms should not cause style-warnings
Reported by: | rschlatte | Owned by: | rschlatte |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.2 |
Component: | compiler | Version: | 1.2.0-dev |
Keywords: | Cc: | ||
Parent Tickets: |
Description
CLHS 7.6.5 says: "The lambda list congruence rules require that each method accept all of the keyword arguments mentioned after &key in the generic function definition, by accepting them explicitly, by specifying&allow-other-keys, or by specifying &rest but not &key."
Currently, when compiling a file containing the form
(defmethod foo ((x fixnum) &key y z) x)
we get style warnings about unused variables y and z. I think that these style warnings can be safely elided, since a typo in the arglist will lead to another style warning "Undefined variable A assumed special".
Change History (21)
comment:1 Changed 12 years ago by
Summary: | Unused &key warnings in defmethod forms should not cause style-warnings → Unused &key arguments in defmethod forms should not cause style-warnings |
---|
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
The best solution would be to take all keyword arguments from the generic function and, intersect them with the keys from the method function and add an IGNORABLE declaration for them: that'll generate style warnings for any keys specific for the method, but not for the ones inherited from the GF.
comment:4 Changed 12 years ago by
Owner: | changed from ehuelsmann to rschlatte |
---|---|
Status: | new → assigned |
I'm assuming Rudi picks up this one. Please feel free to re-assign if that's not the case.
comment:5 Changed 12 years ago by
Milestone: | → 1.2.0 |
---|---|
Version: | → 1.2.0-dev |
comment:6 Changed 11 years ago by
Milestone: | 1.2.0 → 1.3.0 |
---|
comment:9 Changed 11 years ago by
Milestone: | 2.0.0 → 1.4.0 |
---|
comment:14 Changed 4 years ago by
Milestone: | 1.6.2 → 1.7.0 |
---|
comment:19 Changed 3 years ago by
Milestone: | 1.8.1 → 1.9.0 |
---|
comment:20 Changed 22 months ago by
Milestone: | 1.9.0 → 1.9.1 |
---|
comment:21 Changed 21 months ago by
Milestone: | 1.9.1 → 1.9.2 |
---|
Pascal Costanza, the original reporter, commented on armedbear-devel (August 26 2012, "Re: warnings for method keywords (was Re: Closer-mop support for ABCL)"):
This is not the part I'm referring to. It's rather this one: "The set of keyword arguments accepted by the generic function for a particular call is the union of the keyword arguments accepted by all applicable methods and the keyword arguments mentioned after &keyin the generic function definition, if any."
To illustrate: Assume the following definitions.
If you invoke foo on an instance of my-class, the keyword parameter :d is accepted, although it is not used inside the body. This can be important, depending on circumstances (for example, when implementing specifications that require certain keywords to be accepted, as is the case for the CLOS MOP).
However, you seem to agree to drop the style warning, so that's ok… ;)