281: COMPUTE-EFFECTIVE-METHOD error signalling.
(slightly obscured by a non-0 default value for
It would be natural for COMPUTE-EFFECTIVE-METHOD to signal errors
when it finds a method with invalid qualifiers. However, it
shouldn't signal errors when any such methods are not applicable to
the particular call being evaluated, and certainly it shouldn't when
simply precomputing effective methods that may never be called.
(setf sb-pcl::*max-emf-precomputation-methods* 0)
(defgeneric foo (x)
(:method ((x symbol)) 1)
(:method + ((x number)) x))
(foo 1) -> ERROR, but should simply return 1
The issue seems to be that construction of a discriminating function
calls COMPUTE-EFFECTIVE-METHOD with methods that are not all applicable.
The following patch fixes this:
RCS file: /cvsroot/sbcl/sbcl/src/pcl/dfun.lisp,v
retrieving revision 1.34
diff -u -u -r1.34 dfun.lisp
--- src/pcl/dfun.lisp 19 Sep 2004 09:32:27 -0000 1.34
+++ src/pcl/dfun.lisp 9 May 2005 15:59:53 -0000
@@ -691,7 +691,8 @@
(defun make-dispatch-dfun (gf)
- (values (get-dispatch-function gf) nil (dispatch-dfun-info)))
+ (let ((*in-precompute-effective-methods-p* t))
+ (values (get-dispatch-function gf) nil (dispatch-dfun-info))))
(defun get-dispatch-function (gf)
(let* ((methods (generic-function-methods gf))
... however, since I'm not too comfy around the dfun protocol I don't
really have any idea yet if this is the right place for this sort of
thing or not. Anyone with PCL chops is welcome to set me straight...
-- Nikodemus Schemer: "Buddha is small, clean, and serious."
Lispnik: "Buddha is big, has hairy armpits, and laughs."