Message.st
changeset 1 a27a279701f8
child 3 24d81bf47225
equal deleted inserted replaced
0:aa2498ef6470 1:a27a279701f8
       
     1 "
       
     2  COPYRIGHT (c) 1988-92 by Claus Gittinger
       
     3               All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 Object subclass:#Message
       
    14        instanceVariableNames:'selector args'
       
    15        classVariableNames:''
       
    16        poolDictionaries:''
       
    17        category:'Kernel-Methods'
       
    18 !
       
    19 
       
    20 Message comment:'
       
    21 
       
    22 COPYRIGHT (c) 1988-93 by Claus Gittinger
       
    23               All Rights Reserved
       
    24 
       
    25 these are only created, when a message fails (i.e. is not understood) -
       
    26 the selector and arguments are put into an instance of Message, which is then
       
    27 passed to doesNotUnderstand:aMessage as argument.
       
    28 
       
    29 This allows for re-evaluation of the failed send (after some cleanup).
       
    30 As an example of its use, see the implementation of the Autoload-class.
       
    31 
       
    32 %W% %E%
       
    33 '!
       
    34 
       
    35 !Message class methodsFor:'instance creation'!
       
    36 
       
    37 selector:aSymbol
       
    38     "return a new message object for a send without arguments"
       
    39 
       
    40     ^ self basicNew selector:aSymbol
       
    41                    arguments:nil
       
    42 !
       
    43 
       
    44 selector:aSymbol with:anArg
       
    45     "return a new message object for a send with one argument"
       
    46 
       
    47     ^ self basicNew selector:aSymbol
       
    48                    arguments:(Array with:anArg)
       
    49 !
       
    50 
       
    51 selector:aSymbol with:arg1 with:arg2
       
    52     "return a new message object for a send with two arguments"
       
    53 
       
    54     ^ self basicNew selector:aSymbol
       
    55                    arguments:(Array with:arg1 with:arg2)
       
    56 !
       
    57 
       
    58 selector:aSymbol withAll:argArray
       
    59     "return a new message object for a send with many arguments"
       
    60 
       
    61     ^ self basicNew selector:aSymbol
       
    62                    arguments:argArray
       
    63 ! !
       
    64 
       
    65 !Message methodsFor:'private accessing'!
       
    66 
       
    67 selector:aSymbol arguments:argArray
       
    68     "set selector and arguments of the receiver"
       
    69 
       
    70     selector := aSymbol.
       
    71     args := argArray
       
    72 ! !
       
    73 
       
    74 !Message methodsFor:'accessing'!
       
    75 
       
    76 selector
       
    77     "return the selector of the message"
       
    78 
       
    79     ^ selector
       
    80 !
       
    81 
       
    82 arguments
       
    83     "return the arguments of the message"
       
    84 
       
    85     ^ args
       
    86 ! !
       
    87 
       
    88 !Message methodsFor:'printing'!
       
    89 
       
    90 printString
       
    91     "return a string for printing the receiver"
       
    92 
       
    93     ^ selector printString
       
    94 ! !