[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


I wanted to test the method NO-APPLICABLE-METHOD.
In "2. Functions in the Programmer Interface" stands:
"The generic function NO-APPLICABLE-METHOD is not intended to be called by
programmers. Programmer may write methods for it."
This is what I wanted but I can't build a specialized method for it.

Is it a bug in PCL or did I do something wrong?

(defmethod no-applicable-method :before (i &rest args)
	(print "before"))
(setq s-f (symbol-function 'no-aplicable-method))
(desribe s-f)
--->> ...

(format t "~%Primary: ~a" 
	(get-method s-f nil (list (find-class 't))))
--->> Primary: #<Standard-Method NO-APPLICABLE-METHOD (T) 15045360>

(format t "~%Before : ~a" 
	(get-method s-f '(:before) (list (find-class 't))))
--->> Before : #<Standard-Method NO-APPLICABLE-METHOD 
			:BEFORE  (T) 15045360>

(defclass a () ())
(defclass b () ())
(defmethod m ((i a)) (print "method M"))
(setq x (make-instance 'a))
(setq y (make-instance 'b))

(m x)
--->> "method M"

(m y)
--->> Error: No matching method for the generic-function
			#<compiled-closure PCL::METHOD-FUNCTION>,
			when called with arguments (NIL).

Holger Gottwald