Plaster
New
List
Login
common-lisp
default
phoe
2020.05.15 18:35:44
(defclass substandard-method (standard-method) ()) (defgeneric frobnicate (thing)) (defun test () (let* ((gf (fdefinition 'frobnicate)) (lambda-list `(thing)) (lambda `(lambda ,lambda-list (print thing))) (method-lambda (c2mop:make-method-lambda gf (closer-mop:class-prototype (find-class 'substandard-method)) lambda nil)) (method (make-instance 'substandard-method :function (compile nil method-lambda) :lambda-list lambda-list :qualifiers '() :specializers (list (find-class t))))) method)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER> (defvar *method* (test)) *METHOD* CL-USER> *method* #<SUBSTANDARD-METHOD (#<SB-PCL:SYSTEM-CLASS COMMON-LISP:T>) {10148D5643}> CL-USER> (add-method #'frobnicate *) #<STANDARD-GENERIC-FUNCTION COMMON-LISP-USER::FROBNICATE (1)> CL-USER> *method* #<SUBSTANDARD-METHOD COMMON-LISP-USER::FROBNICATE (T) {10148D5643}> CL-USER> (c2mop:generic-function-methods #'frobnicate) (#<SUBSTANDARD-METHOD COMMON-LISP-USER::FROBNICATE (T) {10148D5643}>)
Raw
Annotate
Repaste