WeakArray and triggering events....

Peter Smet peter.smet at flinders.edu.au
Fri May 21 06:56:42 UTC 1999


Ok,

Here is a change set that implements publish-subscribe as described
below for Squeak. I would really appreciate it if some people could
file it in and take it for a test-drive. It seems to work fine for me at
this stage, but I'm sure the code could be greatly improved.

Lets put this open source stuff to the test - I would much rather
that other people hacked into this code and improved it instead of
working on it independently.

Most of the code is in the class PostOffice under Publish-Subscribe,
but some is in Object under the protocol Publish-Subscribe.

Here's an extract from my original post:

"

I have been trying to implement a publish subscribe mechanism along
the lines of Dolphin and VW. With it, any object can trigger events such as

Transcript trigger: #bang.
an interest in events is registered by the message:
Transcript when: #bang send: #run to: self
etc.

The disadvantage of publish subscribe is that you must explicitly deregister
objects from the mechanism for them to be garbage collected.
I have tried to get around this by using  weakKeyDictionaries to hold both
the publishers and the subscribers. If there are no remaining references to
either the publisher or the subscriber, these will be garbage collected, and
no events will be passed to these deceased objects.

"

Peter


Content-Type: application/octet-stream;
	name="Publish-Subscribe.21May412pm.cs"
Content-Disposition: attachment;
	filename="Publish-Subscribe.21May412pm.cs"

Attachment converted: Anon:Publish-Subscribe.21May412pm.cs 
(????/----) (0000A767) 





More information about the Squeak-dev mailing list