; Define a temporary cons cell for use by sendm (defvar *sendmcons* (cons nil nil)) ; Send a message to an object (defun sendm (object selectorrest args) (let (method class) (unless (setq class (class-of object)) (error "Object ~S has no Class." object)) (if (setq method (findmethod selector class)) (progn (rplaca *sendmcons* object) (rplacd *sendmcons* args) (apply method *sendmcons*)) (error "No method ~A for object ~S" selector object)) )) ; Find a method for a given selector and class (defun findmethod (selector class) (if (classp class) (or (cadr (assoc selector (get class 'methods))) (some #'(lambda (super) (findmethod selector super)) (get class 'supers))) ) ) )
Contents    Page-10    Prev    Next    Page+10    Index