[RFC] Object>>perform:orSendTo:

danil danil at tsnet.ru
Tue Feb 17 07:37:03 UTC 2004


Hi, list

Why Object>>perform:orSendTo: is implemented as
[code]
perform: selector orSendTo: otherTarget
        "If I wish to intercept and handle selector myself, do it; else send it to otherTarget"
        ^ otherTarget perform: selector
[/code]
instead of:
[code]
perform: selector orSendTo: otherTarget
        "Selector was just chosen from a menu by a user.  If can respond, then
perform it on myself. If not, send it to otherTarget, presumably the
editPane from which the menu was invoked."

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

Currently second implementation is copy-pasted to twenty classes.
And furthermore, it is not clear, that model of PluggableListMorph
should provide such esoteric-looking method in addition to #list,
#getSelectedIdx, #menu, etc.. methods. Can things be simpler?




More information about the Squeak-dev mailing list