[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Redefining before and after methods in CLOS
- To: email@example.com
- Subject: Redefining before and after methods in CLOS
- From: Shannon V Spires <firstname.lastname@example.org>
- Date: Fri, 18 Mar 1994 09:33:24 -0700 (MST)
Rob Browning writes:
> Is there a way to redefine before and after methods for a class in CLOS
> without quitting and restarting the program? From what I can tell, if you
> re-evaluate a definition of a before or after method it is added to the
> list of before or after methods for the class.
> I would be satisfied to be able to either clear all the existing before and
> after methods of a given name from a class or to redefine them.
As long as you redefine a before or after method on EXACTLY THE SAME
CLASS as before, the new one will destroy the old one and replace it.
The effects of before and after methods are only cumulative if you
define a second before or after method on a class that is a super-
or subclass of one that already has a before or after method.
Thus one way to effectively kill a before, after or around method is to
redefine it like this:
(defmethod foo :before ((me tarzan)...)
where tarzan is the exact class name whose before method
you want to kill. "Foo" of course also has to match the old method name.
If you want to explicitly kill a before or after method, it's fairly
easy to do it in the inspector. Just inspect the generic function's name,
double-click on the "Function:" line in the inspector, then double-click
on the method you want to kill, then choose "Kill Method" in the
Commands popup menu. (This requires the use of Mark Nahabedian's
clos-inspector-hacks code available in the contrib directory of