methodical icon indicating copy to clipboard operation
methodical copied to clipboard

Implement reversed-method-combination that reverses order methods are applied

Open camsaul opened this issue 6 years ago • 0 comments

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

camsaul avatar Sep 10 '19 01:09 camsaul