I'm still relatively new to Pharo and to Smalltalk in general, and
I've hit a situation where I'd like a model that notifies dependent
views when it changes.

Classically, it looks like this was done through #addDependent:,
#update, #changed, #release and friends. I don't need more than a
symbol message and an associated object, so I could live with that
API, but I don't quite understand #release. It sounds like originally
Object class held (non-weak) references to all objects that had
dependents, so unless the dependents were explicitly released, the
objects would never be released. I get the impression that at some
point this was switched to using weak references, so I wouldn't have
to worry about closed parent/dependent loops, but I can't find this
explicitly spelled out anywhere.

- Question 1: Does the basic addDependent/etc. system on Pharo use
weak references?
- Question 2: Am I correct in understanding that the main point of the
Model class was to avoid having an entry in the Object class variable,
so a closed parent/dependent loop could be garbage collected?
- Question 3: If Pharo uses weak references, is there any point to the
Model class?

I've also seen some references to the Announcements framework, but I
can't find as much documentation on it as I can on the "basic"
Smalltalk dependency mechanism. It seems a bit more complex, with
actual event classes, but I've not understood it yet.

- Question 4: Should I prefer using Announcements for even mostly trivial cases?
- Question 5: What benefits would Announcements give me?

Any overall pointers would be appreciated as well.

Thanks,
Johann

Reply via email to