3 ms·
Covered in Common Lisp by custom method combinations. A "method combination" determines, when a generic function call denotes multiple methods, in which order
by kazinator 9y ago
Covered in Common Lisp by custom method combinations.
A "method combination" determines, when a generic function call denotes multiple methods, in which order they are called.
There is a default method combination with standard features: :pre/:post/:around auxiliary methods in relation to a primary method. This has the conventional ordering: derived controls dispatch. E.g. an :around method can decide that the primary method won't be executed at all by not calling (call-next-method).
The documentation for the define-method-combination macro is a bit of a challenging read. One of the examples of its "long forms" shows how the standard method combination would be defined with this macro, if it didn't exist. A simple example shows how to arrange for methods to be dispatched one by one until one returns something other than nil.