eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Message':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Message


Inheritance:

   Object
   |
   +--Message
      |
      +--ActiveObject::MessageAndResponse
      |
      +--MessageSend

Package:
stx:libbasic
Category:
Kernel-Methods
Version:
rev: 1.38 date: 2017/02/22 17:56:46
user: cg
file: Message.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


Instances of Message represent a message being sent, consisting of
the message selector and the message arguments.

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 message
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 receiver's class,
so the lookup finds Object>>doesNotUnderstand: and this is evaluated.
There, a debugger is opened on the suspended thread (actually, it is a little
more complicated: actually a MessageNotUnderstood exception is raised there,
which - if not handled by an exception handler - opens the debugger).

However, it is possible and common to redefine the doesNotUnderstand method, 
which allows for re-evaluation of the failed send (after some cleanup),
to upload some code, to forward the message to another destination,
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: as mentioned above, Object>>doesNotUnderstand: actually
raises an exception which can be handled. In many situations, providing 
an exception handler instead of redefining #doesNotUnderstand is the 
better way to do things.


Notice:
The layout of Message-objects is known by the runtime system (VM)
(it has to create those objects in case of a failure)
so 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  displayOn: aGCOrStream
Compatibility
append a printed desription on some stream (Dolphin, Squeak)
OR:
display the receiver in a graphicsContext at 0@0 (ST80).
This method allows for any object to be displayed in some view
(although the fallBack is to display its printString ...)

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(s) to aReceiver

o  sendTo: aReceiver usingClass: aClass
send the selector with argument(s) to aReceiver using the method named by selector from aClass

o  sendTo: aReceiver usingMethod: aMethod
send the selector with argument(s) to aReceiver using compiledMethod aMethod



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Thu, 19 Jul 2018 06:12:29 GMT