equal
deleted
inserted
replaced
19 |
19 |
20 MessageSend comment:' |
20 MessageSend comment:' |
21 COPYRIGHT (c) 1994 by Claus Gittinger |
21 COPYRIGHT (c) 1994 by Claus Gittinger |
22 All Rights Reserved |
22 All Rights Reserved |
23 |
23 |
24 $Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.1 1994-08-05 01:06:59 claus Exp $ |
24 $Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.2 1994-10-10 00:53:52 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !MessageSend class methodsFor:'documentation'! |
27 !MessageSend class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.1 1994-08-05 01:06:59 claus Exp $ |
45 $Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.2 1994-10-10 00:53:52 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
56 '[receiver perform:selector withArguments:arguments]', |
56 '[receiver perform:selector withArguments:arguments]', |
57 but blocks are somewhat more expensive in their creation and use. |
57 but blocks are somewhat more expensive in their creation and use. |
58 However, the send-operation itself is faster in a block, since it |
58 However, the send-operation itself is faster in a block, since it |
59 will use a better caching scheme (inline-cache) for its send, while |
59 will use a better caching scheme (inline-cache) for its send, while |
60 sending here is done with a #perform:, which is not inline-cached. |
60 sending here is done with a #perform:, which is not inline-cached. |
|
61 Thus it is not sure, which one is faster in the end ... |
61 |
62 |
62 Example: |
63 Example: |
63 |
64 |
64 |m| |
65 |m| |
65 |
66 |
83 !MessageSend class methodsFor:'instance creation'! |
84 !MessageSend class methodsFor:'instance creation'! |
84 |
85 |
85 receiver:r selector:sel arguments:argArray |
86 receiver:r selector:sel arguments:argArray |
86 |newMessage| |
87 |newMessage| |
87 |
88 |
88 newMessage := super selector:sel arguments:argArray. |
89 newMessage := super setSelector:sel arguments:argArray. |
89 newMessage receiver:r. |
90 newMessage receiver:r. |
90 ^ newMessage |
91 ^ newMessage |
91 ! ! |
92 ! ! |
92 |
93 |
93 !MessageSend methodsFor:'evaluation'! |
94 !MessageSend methodsFor:'evaluation'! |
94 |
95 |
95 value |
96 value |
96 "evaluate the messagesend" |
97 "evaluate the messagesend with the original arguments" |
97 |
98 |
98 ^ receiver perform:selector withArguments:args |
99 ^ receiver perform:selector withArguments:args |
99 ! |
100 ! |
100 |
101 |
101 value:someArgument |
102 value:someArgument |
103 |
104 |
104 ^ receiver perform:selector with:someArgument |
105 ^ receiver perform:selector with:someArgument |
105 ! |
106 ! |
106 |
107 |
107 value:arg1 value:arg2 |
108 value:arg1 value:arg2 |
108 "evaluate the messagesend, with arg1 and arg2 instead of the original" |
109 "evaluate the messagesend, with arg1 and arg2 instead of the original |
|
110 arguments" |
109 |
111 |
110 ^ receiver perform:selector with:arg1 with:arg2 |
112 ^ receiver perform:selector with:arg1 with:arg2 |
111 ! |
113 ! |
112 |
114 |
113 value:arg1 value:arg2 value:arg3 |
115 value:arg1 value:arg2 value:arg3 |
114 "evaluate the messagesend, with arg1, arg2 and arg3 instead of the original" |
116 "evaluate the messagesend, with arg1, arg2 and arg3 instead of the original |
|
117 arguments" |
115 |
118 |
116 ^ receiver perform:selector with:arg1 with:arg2 with:arg3 |
119 ^ receiver perform:selector with:arg1 with:arg2 with:arg3 |
117 ! ! |
120 ! ! |
118 |
121 |
119 !MessageSend methodsFor:'accessing'! |
122 !MessageSend methodsFor:'accessing'! |
143 |
146 |
144 receiver printOn:aStream. |
147 receiver printOn:aStream. |
145 aStream nextPutAll:'>>'. |
148 aStream nextPutAll:'>>'. |
146 selector printOn:aStream |
149 selector printOn:aStream |
147 ! ! |
150 ! ! |
148 |
|