>> No, because the Announcement>>#handles: takes a class, not an instance.
>>
>
> you mean here:
>
> deliver: anAnnouncement
> " deliver an announcement to receiver. In case of failure, it will be
> handled in separate process"
>
> ^ (self handles: anAnnouncement class ) ifTrue: [
> [action cull: anAnnouncement cull: announcer]
> on: UnhandledError fork: [:ex | ex pass ]]
>
> we can simply change the 'anAnnouncement class' to just 'anAnnouncement'
> so the receiver of #handles: will see an announcement itself not its class.
>
> It is probably right thing to do, because then you can do:
>
>
> announcer on: foo do: [... ].
>
> announcer announce: 10.
>
> Then foo will receive:
>
> foo handles: 10.
> and in your own #handles: implementation you can do something like:
>
> handles: anAnnouncement
> ^ anAnnouncement isInteger
Yes, #handles: should take an instance not a class. And #handles:
should be implemented as
Announcement class>>#handles: anAnnouncement
^ anAnnouncement isKindOf: self
I guess this is partially my fault, because I called the argument
anAnnouncementClass even if I passed in an instance.
Lukas
--
Lukas Renggli
www.lukas-renggli.ch