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