Opened 11 years ago

Closed 10 years ago

#600 closed defect (fixed)

defmethod congruency checks

Reported by: rme Owned by:
Priority: normal Milestone:
Component: other Version: trunk
Keywords: clos, mop Cc:


(From Pascal Costanza,

Clozure Common Lisp seems to be too eager in its checking of congruency of generic function lambda lists and those of their methods.

Consider the following example:

? (defgeneric foo (a b c))
? (add-method
   (make-instance 'standard-method
     :qualifiers '()
     :specializers (list (find-class 't) (find-class 't) (find-class 't))
     :lambda-list '(a b c)
     :function (lambda (&rest args) (print args))))
> Error: Lambda list of method #<STANDARD-METHOD NIL (T T T)>
>        is incompatible with that of the generic function FOO.
>        Method's lambda-list : (A B C)
>        Generic-function's   : (A B C)

While executing: CCL::CHECK-DEFMETHOD-CONGRUENCY, in process  

Indeed, check-defmethod-congruency uses the method-function to check for congruency, while it should actually use method-lambda-list for that purpose (at least in non-standard cases).

As far as I can tell at the moment, this is the only remaining step so that I can provide compatibility in Closer to MOP of the generic function invocation protocol to the specification in AMOP.

Change History (2)

comment:1 Changed 10 years ago by lovesan

  • Keywords mop added

It seems that CCL compares method-function's lambda-list with that of generic-function because method-function's one is actually congruent with that of the method.

I'm not sure what does AMOP specify on this case, but in SBCL and clisp, for example, standard-method's method-function takes two arguments - a list of method arguments, and a list of next methods(so, it is possible for method's function to control dispatch mechanism to some extent).

I'm currently working on an open-source library, which allows Common Lisp to interoperate with Microsoft's COM.

This library heavily utilizes MOP, so i've been forced to implement quite hacky workaround for CCL support.

Hope, CCL will improve its MOP implementation soon.

comment:2 Changed 10 years ago by gb

  • Resolution set to fixed
  • Status changed from new to closed

(In [14626]) Use the METHOD object's lambda-list (not the METHOD-FUNCTION's) when determining lambda-list congruency.

This seems to fix ticket:600.

Note: See TracTickets for help on using tickets.