Next: Error-Handling Expressions

Prev: Sending Messages

Passing Messages

A method can pass control of a message to a different ancestor of the current object using a pass expression, which has the following syntax:

pass(arg1, arg2, ...)
The arguments are evaluated from left to right. The result of this expression is the result of calling the ``next'' method with the arguments arg1, arg2, .... The ``next'' method is defined as the method which would be called if the current method, and any other methods which have already passed control of the message, were not defined. This method may not be defined on an ancestor of the current object; you should, in general, not depend on a specific method being called when you use a pass expression.

The called method sees the same current object, sender, and caller as the current method.

The pass expression can cause a ~methodnf errors if the called method does not exist. See Errors for information on how to handle errors.