|
|
Class: Message
Object
|
+--Message
|
+--MessageSend
- Package:
- stx:libbasic
- Category:
- Kernel-Methods
- Version:
- rev:
1.33
date: 2007/05/31 15:51:35
- user: cg
- file: Message.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
Instances of Message represent a message being sent.
During normal execution, message objects are NEVER used -
instead, argument passing is done more performant via the stack
or in registers (depends on how your C compiler passes arguments).
However, messageObjects ARE created, when a message send fails
(i.e. some message is not understood).
In this case, the selector and arguments of the failing messare
are squashed into a new instance of Message, and a #doesNotUnderstand:
message is sent to the original receiver, passing the message object
as argument.
Typically, #doesNotUnderstand: is not redefined in the receivers class,
therefore Object>>doesNotUnderstand: gets evaluated.
There, a debugger is opened and the thread is suspended.
However, it is possible to redefine this method, which
allows for re-evaluation of the failed send (after some cleanup),
to upload some code or to simply ignore the error.
As an example of its use, see the implementation of the Autoload-class,
or how ScrollableView forwards unknown messages to its slave-view.
Elegance hint: actually, Object>>doesNotUnderstand: raises an exception
which can be handled - in most situations, providing an exception handler
instead of redefining #doesNotUnderstand is the better way to do things.
Notice:
Since the layout of Message-objects is known by the runtime system
(it has to create those objects in case of a failure)
it is not allowed to change the definition of this class.
Signal
Exception
MessageSend
instance creation
-
selector: aSymbol
-
return a new message object for a send without arguments
-
selector: aSymbol argument: anArg
-
return a new message object for a send with one argument
-
selector: aSymbol argument: arg1 argument: arg2
-
return a new message object for a send with two arguments
-
selector: aSymbol arguments: argArray
-
return a new message object for a send with many arguments
obsolete
-
selector: aSymbol with: anArg
-
return a new message object for a send with one argument.
OBSOLETE: use #selector:argument: for ST-80 compatibility.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
selector: aSymbol with: arg1 with: arg2
-
return a new message object for a send with two arguments.
OBSOLETE: use #selector:arguments: for ST-80 compatibility.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
selector: aSymbol withAll: argArray
-
return a new message object for a send with many arguments.
OBSOLETE: use #selector:arguments: for ST-80 compatibilty.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
queries
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.
Compatibility-Dolphin
-
value: aReceiver
-
evaluate myself for receiver.
Same as #sendTo: - compatibility with Dolphin
Compatibility-GNU
-
reinvokeFor: aReceiver
-
send the selector with argument to a receiver.
Same as sendTo: - for GNU-ST compatibility.
Compatibility-Squeak
-
argument
-
return the 1st argument of the message
accessing
-
arg1
-
return the first argument of the message
-
argumentCount
-
VisualAge/ANSI compatibility: return the number of arguments of the message
-
arguments
-
return the arguments of the message
-
arguments: argArray
-
set arguments of the receiver
-
numArgs
-
return the number of arguments of the message
-
selector
-
return the selector of the message
-
selector: aSymbol
-
printing & storing
-
displayString
-
return a string for display in inspectors etc.
-
printOn: aStream
-
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
private-accessing
-
setSelector: aSymbol
-
-
setSelector: aSymbol arguments: argArray
-
set selector and arguments of the receiver
sending
-
sendTo: aReceiver
-
send the selector with argument to aReceiver
|