- define-method (obj 'message self resend . args) body ...syntax
This is syntactic sugar for the often-used idiom to define a method slot, by sending a add-method-slot! message with a message name and a lambda form with self, resend and args formals, and a body.
Another common operation is to clone an object, and add a number of value and method slots:
(define o (*the-root-object* 'clone)) (o 'add-value-slot! 'constant 'set-constant! 5) (o 'add-method-slot! 'add (lambda (self resend summand) (+ summand (self 'constant))))
This can be more succintly written as:
(define-object o (*the-root-object*) (constant set-constant! 5) ((add self resend summand) (+ summand (self 'constant)))