call-next-method invocation order

Frank <[email protected]> Sun, 18 Jul 2010 14:15:29 -0600
Newsgroups gmane.emacs.eieio
Message-ID <[email protected]>
Hi there,

I'm not sure maybe there's a problem with (call-next-method)'s 
invocation order with multiple inheritance;

Check this tree out

  +--base
       +--derived1
       |    +--derived2
       |         +--derived3
       +--derivedX
            +--derived3

And here's the code for it;
Well it's kinda a complex example but the point why I bother you guys 
with it is if I run this example on Allegro CL I get a different result;
BTW if I add  :method-invocation-order :depth-first to class derived2 I 
get the same result as on Allegro CL;

As I'm not an expert in CL I'll leave it up to you guys what to do with it;

Thanks
Frank


(require 'cl)
(require 'eieio)

(defclass base ()
  ())
(defmethod func ((this base))
  (foo this))
(defmethod foo ((this base))
  (message "base::foo"))

(defclass derivedX (base)
  ())

(defclass derived1 (base)
  ())
(defmethod foo ((this derived1))
  (message "derived1::foo"))

(defclass derived2 (derived1)
  ()
;;;  :method-invocation-order :depth-first
)
(defmethod foo ((this derived2))
  (call-next-method)
  (message "derived2::foo"))

(defclass derived3 (derived2 derivedX)
  ())

(setq td1 (make-instance 'derived2))
(func td1) ;; Results in:
          ;; derived1::foo
          ;; derived2::foo

;;XXX shouldn't the result be the same as in the former example?
;;XXX on Allegro CL the result is the same as for td1
(setq td2 (make-instance 'derived3))
(func td2) ;; Results in:
          ;; base::foo
          ;; derived2::foo



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first