The Trunk: Kernel-mt.1385.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-mt.1385.mcz

commits-2
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1385.mcz

==================== Summary ====================

Name: Kernel-mt.1385
Author: mt
Time: 14 April 2021, 9:41:34.215665 am
UUID: e4a24d49-fe9d-f043-b842-446b8af102e9
Ancestors: Kernel-nice.1384

Clean up and comment on the idiom #perform:orSendTo:.

=============== Diff against Kernel-nice.1384 ===============

Item was changed:
  ----- Method: Object>>perform:orSendTo: (in category 'message handling') -----
  perform: selector orSendTo: otherTarget
+ "Generic callback for an object composition. If the receiver can respond, then perform the message send on itself. If not, delegate it to otherTarget. This can be useful for callbacks in model-view compositions where the model might be the receiver and the view be the otherTarget. Override this to provoke a message-not-understood exception or otherwise tweak the send."
+
+ ^ (self respondsTo: selector)
+ ifTrue: [self perform: selector]
+ ifFalse: [otherTarget perform: selector]!
- "If I wish to intercept and handle selector myself, do it; else send it to otherTarget"
- ^ (self respondsTo: selector) ifTrue: [self perform: selector] ifFalse: [otherTarget perform: selector]!