eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Message':

Home

everywhere
www.exept.de
for:
[back]

Class: Message


Inheritance:

   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

Description:


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.


Related information:

    Signal
    Exception
    MessageSend

Class protocol:

instance creation
o  selector: aSymbol
return a new message object for a send without arguments

o  selector: aSymbol argument: anArg
return a new message object for a send with one argument

o  selector: aSymbol argument: arg1 argument: arg2
return a new message object for a send with two arguments

o  selector: aSymbol arguments: argArray
return a new message object for a send with many arguments

obsolete
o  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) **

o  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) **

o  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
o  isBuiltInClass
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.


Instance protocol:

Compatibility-Dolphin
o  value: aReceiver
evaluate myself for receiver.
Same as #sendTo: - compatibility with Dolphin

Compatibility-GNU
o  reinvokeFor: aReceiver
send the selector with argument to a receiver.
Same as sendTo: - for GNU-ST compatibility.

Compatibility-Squeak
o  argument
return the 1st argument of the message

accessing
o  arg1
return the first argument of the message

o  argumentCount
VisualAge/ANSI compatibility: return the number of arguments of the message

o  arguments
return the arguments of the message

o  arguments: argArray
set arguments of the receiver

o  numArgs
return the number of arguments of the message

o  selector
return the selector of the message

o  selector: aSymbol

printing & storing
o  displayString
return a string for display in inspectors etc.

o  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
o  setSelector: aSymbol

o  setSelector: aSymbol arguments: argArray
set selector and arguments of the receiver

sending
o  sendTo: aReceiver
send the selector with argument to aReceiver



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 21:13:14 GMT