Re: [eieio] :before and :after methods not called
drkm <[email protected]> Mon, 04 Apr 2005 10:09:05 +0200
| Newsgroups | gmane.emacs.cedet,gmane.emacs.eieio |
|---|---|
| Organization | None |
| Message-ID | <[email protected]> |
"Eric M. Ludlam" <[email protected]> writes: > I checked in changes to eieio to do this mechanism for method calls. > I submitted a new test file for methodinvocation tests. Good news. > While I was there, I wrote tests for multiple-inheritance of the > same sort. It seemed call-next-method did not call all subclass's ^^^^^^^^ > method which confused me some. I couldn't find anything in the common > list hyperspec on it during a short futile search. If you know what > it should do in that case, I'd like to know. [ I guess you mean "superclass". ] I think you can take a look at "7.6.6.1 Determining the Effective Method" and "7.6.6.2 Standard Method Combination". Basically, the idea is to build a *sorted* list of applicable methods. call-next-method simply call the next method in this list. By example, in the following: (defclass A () ()) (defclass B () ()) (defclass C (A B) ()) (defmethod f ((A a)) ;; 1 (message "A") (when (next-method-p) (call-next-method))) (defmethod f ((B b)) ;; 2 (message "B") (when (next-method-p) (call-next-method))) (defmethod f ((C c)) ;; 3 (message "C") (when (next-method-p) (call-next-method))) The list is (3 1 2) -- I think there is a specific notation I don't remember, so I use numbers. It's not (3 2 1) because A stands on the left, and B on the right, so A takes precedence over B. It begins with 3 because C is the most derived class. Once you've got this list, the standard method combination says to call only the first one. And call-next-method call the next method in this list. [ Note I speak only about standard method combination. I don't know enough what appens in other method combination types, regarding inheritance. ] --drkm ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click