WeakMessageSends/Events for 3.4
Ned Konz <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.foundation |
|---|---|
| Message-ID | <[email protected]> |
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 image. 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. Thanks, -- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE
WeakMessageSend2-nk-rw.cs.gz
(application/x-gzip, 2.9 KB) - not displayed