Plaster
New
List
Login
common-lisp
default
anonymous
2023.06.09 09:58:48
(defclass super () ()) (defclass sub (super) ()) (defun call-super (method args) (let* ((super-class (class-name (first (mop:class-direct-superclasses (class-of (first args)))))) (super-method (find super-class (mop:compute-applicable-methods method args) :key (lambda (x) (class-name (first (mop:method-specializers x))))))) (funcall (mop:method-function super-method) args nil))) (defgeneric foo (obj) (:method ((obj super)) (format t "Do something super.~%")) (:method ((obj sub)) (format t "I'm not, but I can still...") (call-super #'foo (list obj))))
Raw
Annotate
Repaste
Edit