MessageSend.st
author Stefan Vogel <sv@exept.de>
Fri, 21 Jan 2005 17:51:28 +0100
changeset 8688 c3de1df6642a
parent 8581 89cc7d8986e3
child 11417 af0c3065a5c1
permissions -rw-r--r--
Define #argumentCount as ANSI alias for #numArgs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
     1
"
4da5558d8141 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
344
claus
parents: 160
diff changeset
     3
	      All Rights Reserved
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
     4
4da5558d8141 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
4da5558d8141 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
4da5558d8141 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
4da5558d8141 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
4da5558d8141 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
4da5558d8141 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
4da5558d8141 Initial revision
claus
parents:
diff changeset
    11
"
4da5558d8141 Initial revision
claus
parents:
diff changeset
    12
7781
03095ade1b75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
    13
"{ Package: 'stx:libbasic' }"
5591
08ada63daf2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
    14
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    15
Message subclass:#MessageSend
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    16
	instanceVariableNames:'receiver'
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    17
	classVariableNames:''
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    18
	poolDictionaries:''
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    19
	category:'Kernel-Methods'
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    20
!
4da5558d8141 Initial revision
claus
parents:
diff changeset
    21
4da5558d8141 Initial revision
claus
parents:
diff changeset
    22
!MessageSend class methodsFor:'documentation'!
4da5558d8141 Initial revision
claus
parents:
diff changeset
    23
4da5558d8141 Initial revision
claus
parents:
diff changeset
    24
copyright
4da5558d8141 Initial revision
claus
parents:
diff changeset
    25
"
4da5558d8141 Initial revision
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1994 by Claus Gittinger
344
claus
parents: 160
diff changeset
    27
	      All Rights Reserved
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    28
4da5558d8141 Initial revision
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
4da5558d8141 Initial revision
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
4da5558d8141 Initial revision
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
4da5558d8141 Initial revision
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
4da5558d8141 Initial revision
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
4da5558d8141 Initial revision
claus
parents:
diff changeset
    34
 hereby transferred.
4da5558d8141 Initial revision
claus
parents:
diff changeset
    35
"
4da5558d8141 Initial revision
claus
parents:
diff changeset
    36
!
4da5558d8141 Initial revision
claus
parents:
diff changeset
    37
4da5558d8141 Initial revision
claus
parents:
diff changeset
    38
documentation
4da5558d8141 Initial revision
claus
parents:
diff changeset
    39
"
4da5558d8141 Initial revision
claus
parents:
diff changeset
    40
    Instances of MessageSend can be used for simulation programs.
4da5558d8141 Initial revision
claus
parents:
diff changeset
    41
    They keep some receiver, selector and arguments and can be evaluated
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    42
    at any time later. (basically, they are like MessageObjects, but keep
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    43
    the receiver in addition to the selector & arguments).
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    44
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    45
    They can also be used as replacement for simple [self foo]-blocks.
4da5558d8141 Initial revision
claus
parents:
diff changeset
    46
    Of course, they could also be replaced by blocks such as
4da5558d8141 Initial revision
claus
parents:
diff changeset
    47
    '[receiver perform:selector withArguments:arguments]', 
344
claus
parents: 160
diff changeset
    48
    but blocks are somewhat more expensive in their creation and require
claus
parents: 160
diff changeset
    49
    more storage.
claus
parents: 160
diff changeset
    50
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    51
    If you plan to write a simulator and want to queue cillions of blocks,
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    52
    try to use MessageSends instead of blocks
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    53
    (or even: message, if the receiver is constant);
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    54
    this will save you a lot of memory.
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    55
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    56
    However, the send-operation itself is faster in a block, since it
4da5558d8141 Initial revision
claus
parents:
diff changeset
    57
    will use a better caching scheme (inline-cache) for its send, while
4da5558d8141 Initial revision
claus
parents:
diff changeset
    58
    sending here is done with a #perform:, which is not inline-cached. 
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    59
    Also, blocks are more flexible, in that they allow access to local
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    60
    variables of the defining method - and work without a need to define an
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    61
    extra visited method (read literature on visitor patterns).
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    62
363
claus
parents: 344
diff changeset
    63
    Thus it is not sure, which one is actually better to use ...
claus
parents: 344
diff changeset
    64
claus
parents: 344
diff changeset
    65
    You can either store arguments in the messageSend object, or
claus
parents: 344
diff changeset
    66
    leave them undefined until the send is actually performed, and
claus
parents: 344
diff changeset
    67
    pass any arguments with the value:-messages.
1270
4e8058487ed3 commentary
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
    68
4e8058487ed3 commentary
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
    69
    [See also:]
4e8058487ed3 commentary
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
    70
        Block  Message
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
    71
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
    72
    [author:]
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
    73
        Claus Gittinger
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    74
"
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    75
!
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    76
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    77
examples
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    78
"
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    79
    Example:
4da5558d8141 Initial revision
claus
parents:
diff changeset
    80
       |m|
4da5558d8141 Initial revision
claus
parents:
diff changeset
    81
4da5558d8141 Initial revision
claus
parents:
diff changeset
    82
       m := MessageSend receiver:1 selector:#+ arguments:#(2).
363
claus
parents: 344
diff changeset
    83
       m value. 
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    84
1316
248a8cb2ae3b examples
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
    85
248a8cb2ae3b examples
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
    86
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    87
    is almost the same as:
344
claus
parents: 160
diff changeset
    88
       |m|
claus
parents: 160
diff changeset
    89
claus
parents: 160
diff changeset
    90
       m := [1+2].
363
claus
parents: 344
diff changeset
    91
       m value. 
344
claus
parents: 160
diff changeset
    92
claus
parents: 160
diff changeset
    93
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    94
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    95
    Example2 (a simulation)
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    96
        |q|
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
    97
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    98
        q := Queue new.
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    99
        ...
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   100
        'put some action into the queue'
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   101
        q nextPut:(MessageSend receiver:someone selector:#foo arguments:#().
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   102
        ...
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   103
        'evaluate next action from the queue'
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   104
        q next value
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   105
        ...
344
claus
parents: 160
diff changeset
   106
claus
parents: 160
diff changeset
   107
    if all sends are going to the same receiver, use:
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   108
        |q|
344
claus
parents: 160
diff changeset
   109
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   110
        q := Queue new.
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   111
        ...
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   112
        'put some action into the queue'
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   113
        q nextPut:(Message selector:#foo arguments:#().
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   114
        ...
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   115
        'evaluate next action from the queue'
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   116
        q next sendTo:someone
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   117
        ...
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   118
"
4da5558d8141 Initial revision
claus
parents:
diff changeset
   119
! !
4da5558d8141 Initial revision
claus
parents:
diff changeset
   120
4da5558d8141 Initial revision
claus
parents:
diff changeset
   121
!MessageSend class methodsFor:'instance creation'!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   122
2473
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   123
receiver:r selector:sel
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   124
    "create & return a new instance which can be used to
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   125
     send sel to some receiver, r"
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   126
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   127
    ^ self receiver:r selector:sel arguments:nil
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   128
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   129
    "
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   130
     (MessageSend receiver:nil selector:#foo) value
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   131
    "
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   132
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   133
    "Modified: 20.3.1997 / 21:55:16 / cg"
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   134
!
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   135
5669
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   136
receiver:r selector:sel argument:something
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   137
    "create & return a new instance which can be used to
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   138
     send sel with arguments to some receiver, r"
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   139
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   140
    ^ self receiver:r selector:sel arguments:(Array with:something)
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   141
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   142
    "
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   143
     (MessageSend receiver:nil selector:#foo: argument:1) value
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   144
    "
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   145
!
b3b9daefb6b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5591
diff changeset
   146
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   147
receiver:r selector:sel arguments:argArray
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   148
    "create & return a new instance which can be used to
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   149
     send sel with arguments to some receiver, r"
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   150
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   151
    |newMessage|
4da5558d8141 Initial revision
claus
parents:
diff changeset
   152
344
claus
parents: 160
diff changeset
   153
    newMessage := super new setSelector:sel arguments:argArray.
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   154
    newMessage receiver:r.
4da5558d8141 Initial revision
claus
parents:
diff changeset
   155
    ^ newMessage
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   156
2473
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   157
    "
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   158
     (MessageSend receiver:nil selector:#foo: arguments:#(1)) value
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   159
    "
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   160
dc61bb1e6d17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
   161
    "Modified: 20.3.1997 / 21:55:44 / cg"
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   162
! !
4da5558d8141 Initial revision
claus
parents:
diff changeset
   163
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   164
!MessageSend methodsFor:'accessing'!
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   165
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   166
argumentCount
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   167
    "VisualAge/ANSI compatibility: return the number of arguments of the message"
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   168
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   169
    ^ selector argumentCount
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   170
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   171
    "Modified: 23.4.1996 / 16:52:51 / cg"
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   172
!
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   173
8581
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   174
numArgs
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   175
    "return the number of arguments of the message"
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   176
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   177
    ^ selector numArgs
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   178
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   179
    "Modified: 23.4.1996 / 16:52:51 / cg"
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   180
!
89cc7d8986e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8580
diff changeset
   181
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   182
receiver
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   183
    "return the receiver of the message"
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   184
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   185
    ^ receiver
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   186
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   187
    "Modified: 23.4.1996 / 16:52:59 / cg"
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   188
!
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   189
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   190
receiver:r
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   191
    "set the receiver of the message"
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   192
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   193
    receiver := r
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   194
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   195
    "Modified: 23.4.1996 / 16:53:04 / cg"
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   196
! !
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   197
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   198
!MessageSend methodsFor:'evaluation'!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   199
4da5558d8141 Initial revision
claus
parents:
diff changeset
   200
value
160
5dae57a490bd *** empty log message ***
claus
parents: 96
diff changeset
   201
    "evaluate the messagesend with the original arguments"
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   202
4da5558d8141 Initial revision
claus
parents:
diff changeset
   203
    ^ receiver perform:selector withArguments:args
4da5558d8141 Initial revision
claus
parents:
diff changeset
   204
!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   205
4da5558d8141 Initial revision
claus
parents:
diff changeset
   206
value:someArgument
4da5558d8141 Initial revision
claus
parents:
diff changeset
   207
    "evaluate the messagesend, with someArgument instead of the original"
4da5558d8141 Initial revision
claus
parents:
diff changeset
   208
 
4da5558d8141 Initial revision
claus
parents:
diff changeset
   209
    ^ receiver perform:selector with:someArgument
4da5558d8141 Initial revision
claus
parents:
diff changeset
   210
!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   211
4da5558d8141 Initial revision
claus
parents:
diff changeset
   212
value:arg1 value:arg2
160
5dae57a490bd *** empty log message ***
claus
parents: 96
diff changeset
   213
    "evaluate the messagesend, with arg1 and arg2 instead of the original
5dae57a490bd *** empty log message ***
claus
parents: 96
diff changeset
   214
     arguments"
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   215
8580
106f40c73275 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7781
diff changeset
   216
    ^ receiver perform:selector with:arg1 with:arg2
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   217
!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   218
4da5558d8141 Initial revision
claus
parents:
diff changeset
   219
value:arg1 value:arg2 value:arg3
160
5dae57a490bd *** empty log message ***
claus
parents: 96
diff changeset
   220
    "evaluate the messagesend, with arg1, arg2 and arg3 instead of the original
5dae57a490bd *** empty log message ***
claus
parents: 96
diff changeset
   221
     arguments"
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   222
8580
106f40c73275 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7781
diff changeset
   223
    ^ receiver perform:selector with:arg1 with:arg2 with:arg3
363
claus
parents: 344
diff changeset
   224
!
claus
parents: 344
diff changeset
   225
claus
parents: 344
diff changeset
   226
valueWithArguments:argArray
claus
parents: 344
diff changeset
   227
    "evaluate the messagesend, with arguments taken from argArray,
claus
parents: 344
diff changeset
   228
     instead of the original arguments"
claus
parents: 344
diff changeset
   229
8580
106f40c73275 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7781
diff changeset
   230
    ^ receiver perform:selector withArguments:argArray
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   231
! !
4da5558d8141 Initial revision
claus
parents:
diff changeset
   232
4da5558d8141 Initial revision
claus
parents:
diff changeset
   233
!MessageSend methodsFor:'printing & storing'!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   234
4da5558d8141 Initial revision
claus
parents:
diff changeset
   235
displayString
4da5558d8141 Initial revision
claus
parents:
diff changeset
   236
    "return a string for display in inspectors etc."
4da5558d8141 Initial revision
claus
parents:
diff changeset
   237
5591
08ada63daf2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   238
    ^ self class name , '(' , receiver displayString , '>>' , selector , ')'
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   239
!
4da5558d8141 Initial revision
claus
parents:
diff changeset
   240
4da5558d8141 Initial revision
claus
parents:
diff changeset
   241
printOn:aStream
4392
26fb48f04e1b comment
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
   242
    "append a user printed representation of the receiver to aStream.
26fb48f04e1b comment
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
   243
     The format is suitable for a human - not meant to be read back."
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   244
4da5558d8141 Initial revision
claus
parents:
diff changeset
   245
    receiver printOn:aStream.
4da5558d8141 Initial revision
claus
parents:
diff changeset
   246
    aStream nextPutAll:'>>'.
4da5558d8141 Initial revision
claus
parents:
diff changeset
   247
    selector printOn:aStream
1269
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   248
77682b54144c commentary
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   249
    "Modified: 23.4.1996 / 16:53:35 / cg"
96
4da5558d8141 Initial revision
claus
parents:
diff changeset
   250
! !
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   251
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   252
!MessageSend class methodsFor:'documentation'!
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   253
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   254
version
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8581
diff changeset
   255
    ^ '$Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.20 2005-01-21 16:50:52 stefan Exp $'
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   256
! !