#242: Unused &key warnings in defmethod forms should not cause style-warnings -----------------------+---------------------------------------------------- Reporter: rschlatte | Owner: ehuelsmann Type: defect | Status: new Priority: minor | Milestone: Component: compiler | Version: Keywords: | -----------------------+---------------------------------------------------- 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".
#242: Unused &key arguments in defmethod forms should not cause style-warnings -----------------------+---------------------------------------------------- Reporter: rschlatte | Owner: ehuelsmann Type: defect | Status: new Priority: minor | Milestone: Component: compiler | Version: Keywords: | -----------------------+----------------------------------------------------
#242: Unused &key arguments in defmethod forms should not cause style-warnings -----------------------+---------------------------------------------------- Reporter: rschlatte | Owner: ehuelsmann Type: defect | Status: new Priority: minor | Milestone: Component: compiler | Version: Keywords: | -----------------------+----------------------------------------------------
Comment(by rschlatte):
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.
{{{ (defgeneric foo (x y z &key a b c))
(defmethod foo ((x my-class) y z &key a b c d) (+ y z a b c)) }}}
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… ;)
#242: Unused &key arguments in defmethod forms should not cause style-warnings -----------------------+---------------------------------------------------- Reporter: rschlatte | Owner: ehuelsmann Type: defect | Status: new Priority: minor | Milestone: Component: compiler | Version: Keywords: | -----------------------+----------------------------------------------------
Comment(by ehuelsmann):
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.
#242: Unused &key arguments in defmethod forms should not cause style-warnings -----------------------+---------------------------------------------------- Reporter: rschlatte | Owner: rschlatte Type: defect | Status: assigned Priority: minor | Milestone: Component: compiler | Version: Keywords: | -----------------------+---------------------------------------------------- Changes (by ehuelsmann):
* owner: ehuelsmann => rschlatte * status: new => assigned
Comment:
I'm assuming Rudi picks up this one. Please feel free to re-assign if that's not the case.
#242: Unused &key arguments in defmethod forms should not cause style-warnings -----------------------+---------------------------------------------------- Reporter: rschlatte | Owner: rschlatte Type: defect | Status: assigned Priority: minor | Milestone: 1.2.0 Component: compiler | Version: 1.2.0-dev Keywords: | -----------------------+---------------------------------------------------- Changes (by mevenson):
* version: => 1.2.0-dev * milestone: => 1.2.0
armedbear-ticket@common-lisp.net