On 14 May 2013 16:21, Stéphane Ducasse <stephane.duca...@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

Reply via email to