Contents    Page-10    Prev    Next    Page+10    Index   

Message Sending

Sending a message is just a function call. However, the function ( method) that is called is determined dynamically by the runtime type of the object to which the message is sent.

Sending a message to an object, (send obj draw x y) or obj.draw(x, y) involves the following steps:

  1. Find the method corresponding to the message selector. If the runtime object is a circle, the draw method would be looked up as circle-draw.

  2. Assemble the arguments:

  3. Call the method function with the arguments.

  4. Return the result returned by the method.