[Squeakfoundation]WeakMessageSends/Events for 3.4

Rob Withers squeakfoundation@lists.squeakfoundation.org
Sun, 8 Dec 2002 22:12:56 -0500


I decided to check for this in 3.4 when it suddenly switched to beta and I
read my third message on "hey guys, any other features we want in 3.4?".   I
am very happy that this is going into the image, as this allows very
lightweight event registrations.


----- Original Message -----
From: "Ned Konz" <ned@bike-nomad.com>
To: <squeakfoundation@lists.squeakfoundation.org>
Sent: Sunday, December 08, 2002 1:52 PM
Subject: [Squeakfoundation]WeakMessageSends/Events for 3.4

On Sunday 08 December 2002 08:42 am, Rob Withers wrote:
> 3) Weak message sends and conversion of the NuBlu events to use
> them. Ned, I have an old file from you and a file I wrote to
> integrate into events. We may have diverged implementations long
> ago, so you might have something more current.
> In WeakMessageSend-nk, WeakMessageSends are defined to hold the
> receiver and any arguments, weakly.  Before evaluating, a weak
> message send checks to see if any of its references have
> disappeared, and throws an exception (WeakMessageSendError) if they
> are.  A test case is included.
> In my weak-events changeset, all #when:send:to: registration
> methods store a WeakMessageSend.  This means that objects involved
> in a multicast event registration must be referenced strongly by
> some object in the system, outside of the event registration.  This
> prevents dropped references from being sticky, and encourages
> better design.

Ah, I thought this had already been put into the image.

This is important IMO for use of the new event system. Just as the MVC
DependentsArray is weak, the registration of the new events should
use a weak mechanism like this. Otherwise, subscribers won't get GC'd
unless they first unsubscribe to the events; this is easy to miss.

I've looked over both weak-events.4.cs.gz and
WeakMessageSend-nk.3.cs.gz and they look good together and in the 3.4

They should be loaded with the WeakMessageSend first (or better, made
into a merged CS).

I've attached a combined CS.

Could some of you look this over? I believe we'd be making a mistake
not putting it into 3.4.

Ned Konz