Next: Executing methods
Up: Message Passing Pattern
Previous: Creating instances of a
Contents
Sending messages
To send a message means in our context to invoke the dispatcher of the object
passing the message as an argument. This was done by evaluating the expression:
(define bal-set(acc1 two)).
Invoking the dispatcher caused the following
changes in the diagram below:
- a new envionment frame was created for the dispatcher with the key/value-pair
`msgtwo' stored in it.
- the new environment frame was linked with the previous one
- the dispatcher interpreted the message `two' and returned a pointer to the method
`deposit' to the caller of the function. The call was initiated from the top-level
and therefore changed the top-level environment by adding the variable `bal-set'
assigning it the value returned by the call.
Georg P. Loczewski
2004-03-05