The function override-next-method is similar to call-next-method, except that new arguments can be provided. This allows one method to act as a wrapper for another and set up a special environment for the shadowed method. From the set of methods which are more general than the currently executing one, the most specific method which is applicable to the new arguments is executed. (In contrast, call-next-method calls the next most specific method which is applicable to the same arguments as the currently executing one received.) A recursive call to the generic function itself should be used in lieu of override-next-method if the most specific of all methods for the generic function which is applicable to the new arguments should be executed.
Syntax
(override-next-method <expression>*)
Example
CLIPS> (clear) CLIPS> (defmethod + ((?a INTEGER) (?b INTEGER)) (override-next-method (* ?a 2) (* ?b 3))) CLIPS> (list-defmethods +) + #2 (INTEGER) (INTEGER) + #SYS1 (NUMBER) (NUMBER) ($? NUMBER) For a total of 2 methods. CLIPS> (preview-generic + 1 2) + #2 (INTEGER) (INTEGER) + #SYS1 (NUMBER) (NUMBER) ($? NUMBER) CLIPS> (watch methods) CLIPS> (+ 1 2) MTH >> +:#2 ED:1 (1 2) MTH >> +:#SYS1 ED:2 (2 6) MTH << +:#SYS1 ED:2 (2 6) MTH << +:#2 ED:1 (1 2) 8 CLIPS> (unwatch methods) CLIPS>