Re-2: [Newbies] Catching message send

Lukas Renggli renggli at gmail.com
Tue Oct 31 19:14:02 UTC 2006


> > The original code comes from OmniBrowser. I generalized and extended
> > it a little bit, since I use it in several projects. The original idea
> > of announcements comes from Vassili Bykov as described in
> > <http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?
> > showComments=true&entry=3310034894>.
>
> Ok thanks but What is the aim of Annoucements?

Have a look at Vassili's blog entry, he explains it much more in
detail than I can do here.

Announcements are a clean and object-oriented replacement for the
#change:, #update: and #triggerEvent: hacks in Squeak and other
Smalltalk's.

Announcements can be used pretty much the same way as exceptions,
except that they are not limited to the execution stack. Interested
parties can declare their interest for certain events to an announcer:

   announcer
      on: SomethingChanged
      do: [ :ann | ... ]

Whenever the owner of the announcer triggers an event, all the
registered blocks are evaluated:

   announcer announce: (SomethingChanged new
      foo: 12;
      yourself)

Since announcements are objects they can be passed around, they can
carry data, and they can even modified during the announcement
processing (veto-able announcements).

That's basically it.

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Beginners mailing list