#perform:#orSendTo: question

Samuel Tardieu sam at rfc1149.net
Mon Sep 20 15:49:40 UTC 2004


I wonder why the implementation of Object>>#perform:#orSendTo: looks
counterintuitive to me:

perform: selector orSendTo: otherTarget
	"If I wish to intercept and handle selector myself, do it;
         else send it to otherTarget"
	^ otherTarget perform: selector

I would have naively thought that a correct implementation was:

  (self respondsTo: selector) ifTrue: [ ^self perform: selector ]
                              ifFalse: [ ^otherTarget perform: selector ]

Can I find somewhere an explanation of how this selector is supposed
to be used?

  Sam
-- 
Samuel Tardieu -- sam at rfc1149.net -- http://www.rfc1149.net/sam




More information about the Squeak-dev mailing list