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

call-method ??????



Following my last request about a method dispatching, it appears that it
could be nice to define a function (or macro) that could specify a call to
a method of an arbitrary class.

BUT....

I have a big problem with CALL-METHOD method next-method-list.
In CLtL p 817 it is said : 
[...] It can be used only within an affetive method form, for the name
call-method is defined only within the lexical scope of such a form.
The macro call-method invokes the specified method, supplying it with
arguments and with definitions for call-next-method and for next-method-p.
The arguments are the arguments that were supplied to the effective method
form containing the invocation of call-method. [...]

First: 
 call-method is defined as it in MCl, but as ccl::%call-method, 
ccl::%%call-method,  ccl::%call-method*,  ccl::%%call-method*
 Which one to choose ?

Second : when I use one of these macro, it seems that no arg are supplied
and I get an error

So where I am wrong ???
Thanx in adv


Next is my piece of code :
--------------------------
(defclass A () ())

(defmethod test ((self A))
  (print "test de A"))


(defclass B () ())

(defmethod test ((self B))
  (print "test de B"))


(defclass C (A B) ())

(defmethod test ((self C))
  (print "test de C")
  (call-specific-method 'test 'A)
  (call-specific-method 'test 'B))


(defmacro call-specific-method (method class-name)
  `(ccl::%call-method
      (retrieve-method ,method ,class-name)
      nil
    ))

(setf toto (make-instance 'c))
(test toto)

"test de C" 
> Error: Too few arguments.
> While executing: #<STANDARD-METHOD TEST (A)>
> Type Command-. to abort.
See the Restarts  menu item for further choices.

---
Lafourcade Mathieu
GETA (Groupe d'Etude pour la Traduction Automatique)
BP 53X, 38041 GRENOBLE CEDEX, FRANCE

Lafourca@imag.fr