Let the method-combination sort methods that agree in specializers but not qualifiers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
CLHS 7.6.6.1.2+3 seem to specify that, when the specializers of two methods all agree but the qualifiers disagree, the method combination determines how the the ambiguity is resolved:
7.6.6.1.2: The corresponding parameter specializers from each method are compared. When a pair of parameter specializers agree, the next pair are compared for agreement. If all corresponding parameter specializers agree, the two methods must have different qualifiers; in this case, either method can be selected to precede the other.
7.6.6.1.3: The role of each method in the effective method is determined by its qualifiers and the specificity of the method. A qualifier serves to mark a method, and the meaning of a qualifier is determined by the way that these marks are used by this step of the procedure [method combination].
In this situation, SBCL throws an error saying that there is more than one method with the same specializers.
To reproduce:
(defpackage :mc-test
(:use :cl )
(:export ))
(in-package :mc-test)
(defun positive-
(and (= (length method-qualifiers) 1)
(typep (first method-qualifiers) '(integer 0 *))))
(define-
((methods positive-
`(progn ,@(mapcar #'(lambda (method)
(defgeneric quux (a) (:method-
(defmethod quux 0 (a) (format t "hi there"))
(defmethod quux 1 (a) (format t "bye?"))
(quux)