From: Christophe Rhodes Date: Fri, 7 Feb 2014 10:05:21 +0000 (+0000) Subject: call NO-APPLICABLE-METHOD in the appropriate place X-Git-Tag: els2014-submission~12 X-Git-Url: http://christophe.rhodes.io/gitweb/?a=commitdiff_plain;h=0ec84041118d2b84f0cdb4f3578e63aa1fae6678;p=specializable.git call NO-APPLICABLE-METHOD in the appropriate place Otherwise we end up with NO-PRIMARY-METHODs. We should only compute an EMF if there are in fact some methods, or at least that seems to be the current behaviour of SB-MOP:COMPUTE-EFFECTIVE-METHOD-FUNCTION --- diff --git a/signum-specializer.lisp b/signum-specializer.lisp index a5d21fa..ab7c0de 100644 --- a/signum-specializer.lisp +++ b/signum-specializer.lisp @@ -63,7 +63,10 @@ (defmethod fact ((n (signum 0))) 1) (defmethod fact ((n (signum 1))) (* n (fact (1- n)))) (assert (eql (fact 6) 720)) - (assert (eql (fact 6.0) 720.0)))) + (assert (eql (fact 6.0) 720.0)) + (defmethod no-applicable-method ((gf (eql #'fact)) &rest args) + 'gotcha) + (assert (eql (fact -6) 'gotcha)))) (eval '(progn diff --git a/specializable.lisp b/specializable.lisp index ebe4794..1df14d4 100644 --- a/specializable.lisp +++ b/specializable.lisp @@ -155,10 +155,12 @@ args)))) (defun compute-effective-method-function (gf methods) - (let* ((mc (sb-mop:generic-function-method-combination gf)) - (sb-pcl::*applicable-methods* methods) - (em (sb-mop:compute-effective-method gf mc methods))) - (sb-pcl::make-effective-method-function gf em))) + (if (null methods) + (lambda (&rest args) (apply #'no-applicable-method gf args)) + (let* ((mc (sb-mop:generic-function-method-combination gf)) + (sb-pcl::*applicable-methods* methods) + (em (sb-mop:compute-effective-method gf mc methods))) + (sb-pcl::make-effective-method-function gf em)))) ;; new, not in closette (defgeneric generalizer-of-using-class (generic-function object))