Let the method-combination sort methods that agree in specializers but not qualifiers

Bug #1799666 reported by fiddlerwoaroof
6
This bug affects 1 person
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-integer-qualifier-p (method-qualifiers)
  (and (= (length method-qualifiers) 1)
       (typep (first method-qualifiers) '(integer 0 *))))
(define-method-combination example-method-combination ()
  ((methods positive-integer-qualifier-p))
  `(progn ,@(mapcar #'(lambda (method)
                        `(call-method ,method))
                    (stable-sort methods #'<
                                 :key #'(lambda (method)
                                          (first (method-qualifiers method)))))))
(defgeneric quux (a) (:method-combination example-method-combination))
(defmethod quux 0 (a) (format t "hi there"))
(defmethod quux 1 (a) (format t "bye?"))

(quux)

Tags: review
Revision history for this message
fiddlerwoaroof (fiddler-wo-a-roof+launchpad) wrote :
tags: added: review
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.