Message.st
changeset 1268 38b3714d9eaf
parent 1264 8d916aa63bce
child 1293 02fb05148c98
equal deleted inserted replaced
1267:e285a3a94d9e 1268:38b3714d9eaf
    33 "
    33 "
    34 !
    34 !
    35 
    35 
    36 documentation
    36 documentation
    37 "
    37 "
    38     Instances of Message are only created, when a message send fails 
    38     Instances of Message represent a message being sent.
       
    39     During normal execution, message objects are NEVER used -
       
    40     instead, argument passing is done more performant via the stack
       
    41     or in registers (depends on how your C compiler passes arguments).
       
    42 
       
    43     However, messageObjects ARE created, when a message send fails 
    39     (i.e. some message is not understood).
    44     (i.e. some message is not understood).
    40     In this case, the selector and arguments are put into an instance of 
    45     In this case, the selector and arguments of the failing messare
    41     Message, which is then passed to #doesNotUnderstand: as argument.
    46     are squashed into a new instance of Message, and a #doesNotUnderstand: 
       
    47     message is sent to the original receiver, passing the message object
       
    48     as argument.
    42 
    49 
    43     Typically, Object>>doesNotUnderstand: is evaluated, which starts up
    50     Typically, #doesNotUnderstand: is not redefined in the receivers class,
    44     a debugger, but it is possible to redefine this method, which
    51     therefore Object>>doesNotUnderstand: gets evaluated.
    45     allows for re-evaluation of the failed send (after some cleanup).
    52     There, a debugger is opened and the thread is suspended.
       
    53     However, it is possible to redefine this method, which
       
    54     allows for re-evaluation of the failed send (after some cleanup),
       
    55     to upload some code or to simply ignore the error.
    46 
    56 
    47     As an example of its use, see the implementation of the Autoload-class,
    57     As an example of its use, see the implementation of the Autoload-class,
    48     or how ScrollableView forwards unknown messages to its slave-view.
    58     or how ScrollableView forwards unknown messages to its slave-view.
    49 
    59 
       
    60     Elegance hint: actually, Object>>doesNotUnderstand: raises an exception
       
    61     which can be handled - in most situations, providing an exception handler 
       
    62     instead of redefining #doesNotUnderstand is the better way to do things.
       
    63 
       
    64 
    50     Notice:
    65     Notice:
    51     Since the layout of Message-objects is known by the runtime system, it is 
    66     Since the layout of Message-objects is known by the runtime system
    52     not allowed to change the definition of this class.
    67     (it has to create those objects in case of a failure)
       
    68     it is not allowed to change the definition of this class.
       
    69 
       
    70     [See also:]
       
    71         Signal  Exception  MessageSend
    53 "
    72 "
    54 ! !
    73 ! !
    55 
    74 
    56 !Message class methodsFor:'instance creation'!
    75 !Message class methodsFor:'instance creation'!
    57 
    76 
   158 ! !
   177 ! !
   159 
   178 
   160 !Message class methodsFor:'documentation'!
   179 !Message class methodsFor:'documentation'!
   161 
   180 
   162 version
   181 version
   163     ^ '$Header: /cvs/stx/stx/libbasic/Message.st,v 1.17 1996-04-23 14:03:56 cg Exp $'
   182     ^ '$Header: /cvs/stx/stx/libbasic/Message.st,v 1.18 1996-04-23 14:47:53 cg Exp $'
   164 ! !
   183 ! !