Bert Freudenberg a écrit :
Am 15.07.2008 um 08:26 schrieb Herbert König:
Hello Randal,
RLS> dictionary. This is how the classic "dependents" system works as well: the RLS> dependencies are in a WeakDictionary so that when the watched object goes RLS> away, the dependencies are also cleaned.
thanks for some free education (no smiley, I mean it), now I'll do some homework and look up dependency.
I use it in some places without knowing of it's "weakness".
The dependents are weak only for "regular" objects. Proper Models handle their own dependents collection in a non-weak manner.
- Bert -
Hmm, not really
"Warning: this example is stupid!" | tmp | tmp := Model new. tmp addDependent: #x. tmp addDependent: #y. tmp dependents class. "=> DependentsArray"
DependentsArray is a class that holds weakly to its elements...
The difference is that the DependentsArray itself don't have to pollute the global WeakIdentityKeyDictionary (Object classPool at: #DependentsFields).
But maybe we have just quit the beginners rails...
Nicolas