Re[3]: Newbie: how to enumerate methods in a class
"Eric M. Ludlam" <[email protected]> Tue, 10 Dec 2002 23:01:37 -0500
| Newsgroups | gmane.emacs.eieio |
|---|---|
| Message-ID | <[email protected]> |
>>> Syver Enstad <[email protected]> seems to think that: >> "Eric M. Ludlam" <[email protected]> writes: >> >> > That might look like this: >> > >> > (let ((methods (eieio-all-generic-functions 'yourclasshere))) >> > (while methods >> > (if (string-match "^test-" (symbol-string (car methods))) >> > (funcall (car methods) yourobject other-param)) >> > (setq methods (cdr methods)))) >> > >> > Good Luck. I'll have to try our your new program. > >Here it is. You should be able to see what it does by the tests. > >Btw, I found out how to "clean" up the methods. > >(defun clean () > "Now it works" > (mapcar (lambda (each) > (put each 'eieio-method-obarray nil)) > (eieio-all-generic-functions 'test-case-test)) >) Aha, I see how that would work. Based on this, I've tentatively added this function to EIEIO for the next point release. I'm not sure I like the name much. Enjoy. Eric (defun eieio-unbind-method-implementations (method) "Make the generic method METHOD have no implementations.. It will leave the original generic function in place, but remove reference to all implementations of METHOD." (put method 'eieio-method-tree nil) (put method 'eieio-method-obarray nil)) -- Eric Ludlam: [email protected], [email protected] Home: http://www.ludlam.net Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net GNU: www.gnu.org ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/