generic-function
method
args))
+
+;;; An extension to the ANSI standard: in the presence of e.g. a
+;;; :BEFORE method, it would seem that going through
+;;; NO-APPLICABLE-METHOD is prohibited, as in fact there is an
+;;; applicable method. -- CSR, 2002-11-15
+(defmethod no-primary-method (generic-function &rest args)
+ (error "~@<There is no primary method for the generic function ~2I~_~S~
+ ~I~_when called with arguments ~2I~_~S.~:>"
+ generic-function
+ args))
;; When there are no primary methods and a next-method call occurs
;; effective-method is (error "No mumble..") and the defined
;; args are not used giving a compiler warning.
- (error-p (eq (first effective-method) 'error)))
- `(lambda ,ll
- (declare (ignore ,@(if error-p ll '(.pv-cell. .next-method-call.))))
- ,effective-method))))
+ (error-p (eq (first effective-method) '%no-primary-method)))
+ (cond
+ (error-p
+ `(lambda (.pv-cell. .next-method-call. &rest .args.)
+ (declare (ignore .pv-cell. .next-method-call.))
+ (flet ((%no-primary-method (gf args)
+ (apply #'no-primary-method gf args)))
+ ,effective-method)))
+ (t
+ `(lambda ,ll
+ (declare (ignore ,@(if error-p ll '(.pv-cell. .next-method-call.))))
+ ,effective-method))))))
(defun expand-emf-call-method (gf form metatypes applyp env)
(declare (ignore gf metatypes applyp env))
primary (reverse primary)
around (reverse around))
(cond ((null primary)
- `(error "There is no primary method for the generic function ~S."
- ',generic-function))
+ `(%no-primary-method ',generic-function .args.))
((and (null before) (null after) (null around))
;; By returning a single call-method `form' here we enable
;; an important implementation-specific optimization.
(defgeneric no-next-method (generic-function method &rest args))
+(defgeneric no-primary-method (generic-function &rest args))
+
(defgeneric reader-method-class (class direct-slot &rest initargs))
(defgeneric reinitialize-instance (gf &rest args &key &allow-other-keys))