Something like self performIfExists: #blah would reduce the noise a lot :) Then in this methods, we do what we want ^^ Ben On May 14, 2013, at 5:32 PM, Frank Shearar <frank.shearar@gmail.com> wrote:
On 14 May 2013 16:21, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Hi
I'm in favor killing all the respondsTo:
acceptTextMorphs "Accept any text morphs except for those that have no edits."
self allMorphs do: [:p | ((p respondsTo: #accept) and: [ (p respondsTo: #hasUnacceptedEdits) and: [ p hasUnacceptedEdits]]) ifTrue: [p accept]]
They're a step up from #isKindOf:. It looks like you need is something that says "does this object respond to a particular set of messages (i.e., a Protocol)?". (No, Nicolas, I don't mean a message category! :) )
But in this particular case the solution looks like making a #insertADecentNameHere that particular classes of things can implement as "^ self hasUnacceptedEdits ifTrue: [self accept]"
frank