Logo-small

3.1.2 Subscribing and reacting to events as a Client

User Contributed Notes

sebnozzi (12 November 2012, 2:50 pm)

The way to make a "weak" subscription is as follows: when you pass "on:to:" to the "Announcer", you get an "AnnouncementSubscription" back. You'd need to pass "makeWeak" to it.

 

From the documentation of "WeakAnnouncementSubscription":

 

"To switch between subscription types, use makeStrong/makeWeak on the subscription returned when initially registering with announcer."

 

BUT ... it's not currently supported!! :-(

 

"No support for ephemerons currently prevents this from working for Block actions (blocks hold their receiver, which is the default subscriber strongly)."

 

What is an ephemeron?

 

http://lists.gforge.inria.fr/pipermail/pharo-project/2011-May/049402.html

 

Sebastian Nozzi

simon.denier (7 January 2011, 3:01 am)

Certainly, but what's the status of weak references in Pharo? I always heard they were kind of buggy.

sean (1 January 2011, 6:23 pm)

Wouldn't it be better/more robust to use weak references so you don't leak if you forget to manually unsubscribe?

 

Sean DeNigris

Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |