In this section I will discuss the activation of methods via so-called message passing. The possible method selectors of objects of class class-name are enumerated in the procedure self of the class. If we, for instance, want to activate my-method in instance , it can be done in the following way.
((instance message) actual-parameter ...)
provided that message is mapped to my-method
in the
procedure self
.
Again, I prefer not to use ``the raw procedure call syntax''.
In order to amplify the message sending
metaphor, I prefer the following equivalent form.
(send instance message actual-parameter ...)
The procedure send can be implemented in the following simple way:
(define (send object message . args) (let ((method (object message))) (cond ((procedure? method) (apply method args)) (else (error "Error in method lookup " method)))))