|
Message Specification SheetPortable Object Compiler (c) 1998. All Rights Reserved.
MessageInherits from: ObjectMaturity Index: Experimental
Class DescriptionMessage 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 :
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.- doesNotUnderstand:msg { [msg sentTo:someObject]; return self; } Note: To forward class (factory) methods, override the class method +doesNotUnderstand:. Also see Object's doesNotUnderstand: method for more details.
Method typesCreating MessagesQuerying MessagesSending MessagesMethodsselector:dispatch:args:+selector:(SEL)sdispatch:(ARGIMP)dargs:(void *)aCreates 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 :
The above structure corresponds to a method such as (int)foo:(int)a bar:(double)d.struct { int ret; int a; double d; } The dispatch argument is a (compiler generated) function that decodes the arguments from the argument structure, and dispatches the messages.
selector- (SEL)selectorReturns the selector for this message.
sentTo:-sentTo:receiverForwards 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.
|