methodical
methodical copied to clipboard
Implement reversed-method-combination that reverses order methods are applied
CLOS supports :most-specific-last options for the operator method combinations. Here's an example from Practical Common Lisp:
(defgeneric priority (job)
(:documentation "Return the priority at which the job should be run.")
(:method-combination + :most-specific-last))
I think we can do one better by adding a new reversed-method-combination that wraps any other method combination and reverses the matching primary & aux methods before passing to the combo it wraps. Then methods could be reversed for any method combination.
Bonus: reversing a ReversedMethodCombination should return the original wrapped method combination rather than wrapping it again