Portable Object Compiler (c) 1998.  All Rights Reserved.

Message

Inherits from: Object

Maturity Index: Experimental

Class Description

Message instances are used for forwarding Objective-C messages.  When an object doesn't respond to a message, the doesNotUnderstand: method is invoked, with an argument that is an instance of this class :

- doesNotUnderstand:msg
  {
    [msg sentTo:someObject];
    return self;
  }

The user may override -doesNotUnderstand: to send a sentTo: message, which will forward the message to someObject.  If someObject doesn't respond to the message, it will receive a doesNotUnderstand: message, and so on.

Note: To forward class (factory) methods, override the class method +doesNotUnderstand:.

Also see Object's doesNotUnderstand: method for more details.

Method types

Creating Messages	- selector:dispatch:args:

Querying Messages	- selector

Sending Messages	- sentTo:

Methods

selector:dispatch:args:
+selector:(SEL)sdispatch:(ARGIMP)dargs:(void *)a

Creates a Message instance with the indicated selector name and pointer to argument structure.  The argument structure for a message consists of return value of the method (if not void), followed by the arguments of the method :

struct {
  int ret;
  int a;
  double d;
}

The above structure corresponds to a method such as (int)foo:(int)a bar:(double)d.

The dispatch argument is a (compiler generated) function that decodes the arguments from the argument structure, and dispatches the messages.

selector
- (SEL)selector

Returns the selector for this message.

sentTo:
-sentTo:receiver

Forwards the message to receiver (if it's not nil) and returns the message itself (self), not the return value of the message that was forwarded to receiver.  The latter return value is associated to the Message instance, so that it can be returned to the sender of the message that caused a doesNotUnderstand: message to be sent.