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

method ordering

Here's a question for all you PCL wizards. Suppose I define four
classes as follows:

 (defclass foo0 () nil)
 (defclass foo1 (foo0) nil)
 (defclass bar0 nil nil)
 (defclass bar1 (bar0) nil)

And then define methods "test" on all possible two-way combinations:
(defmethod test ((f foo1) (b bar1))
   (print "1 1")
i.e. (test foo0 bar0) (test foo0 bar1) (test foo1 bar0), and (test
foo1 bar1).

My first question is how does PCL decide in what order the methods are
to be invoked? Does method (test foo0 bar1) come before or after (test
bar0 foo1)? Is it the order of creation of the methods. This was my
best guess.

And my next question is how can this be affected within the methods?
I.e. is it possible to write a method on the most specific classes
(foo1 and bar1) which explicitly calls a method defined on, say, foo0
and bar0, skipping the in-between methods.

Answers would be greatly appreciated. I'm sure this is in the manual
somewhere, but I thought this would be a question of general interest,
so I mailed it to the list.