[armedbear-devel] warnings for method keywords (was Re: Closer-mop support for ABCL)
Pascal Costanza
pc at p-cos.net
Sun Aug 26 15:55:11 UTC 2012
On 26 Aug 2012, at 17:33, Rudolf Schlatte <rudi at constantly.at> wrote:
> [removing closer-devel, but feel free to re-add]
>
> On Aug 26, 2012, at 16:28, Pascal Costanza <pc at p-cos.net> wrote:
>
>> Just a minor thing: Sometimes, you have to declare keyword arguments in CLOS methods just to tell CLOS that a specific keyword argument is acceptable, even if it is not used (see 7.6.5 in the HyperSpec). ABCL gives style-warnings in such cases, but I don't think that should happen…
>
> The relevant sentence being: "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."
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… ;)
Pascal
--
Pascal Costanza
More information about the armedbear-devel
mailing list