39 ! |
39 ! |
40 |
40 |
41 documentation |
41 documentation |
42 " |
42 " |
43 WeakIdentityDictionaries behave like IdentityDictionaries, |
43 WeakIdentityDictionaries behave like IdentityDictionaries, |
44 as long as the keys are still referenced by some |
44 as long as the keys are still referenced by some other (non-weak) object. |
45 other (non-weak) object. |
45 |
46 However, once the last non-weak reference ceases to exist, |
46 However, once the last non-weak reference ceases to exist, |
47 the object will be automatically removed from the Weakcollection |
47 the object will be automatically removed from the Weakcollection |
48 (with some delay: it will be removed after the next garbage collect). |
48 (with some delay: it will be removed after the next garbage collect). |
49 |
49 |
50 This class was added to support keeping track of dependents without |
50 This class was added to support keeping track of dependents without |
51 keeping the values alive - values simply become nil when no one else |
51 keeping the values alive - a value simply become nil when no one else references it. |
52 references it. The original dependency mechanism used a regular Dictionary, |
52 |
53 which usually leads to a lot of garbage being kept due to a forgotten |
53 The original dependency mechanism used a regular Dictionary, |
54 release. Using a WeakDictionary may be incompatible to ST-80 but is much |
54 which usually leads to a lot of garbage being kept due to a forgotten release. |
|
55 Using a WeakDictionary may be incompatible to ST-80 but is much |
55 more comfortable, since no manual release of dependents is needed. |
56 more comfortable, since no manual release of dependents is needed. |
56 |
57 |
57 [Warning:] |
58 [Warning:] |
58 If you use this, be very careful since the collections size changes |
59 If you use this, be very careful since the collections size changes |
59 'magically' - for example, testing for being nonEmpty and then |
60 'magically' - for example, testing for being nonEmpty and then |
60 removing the first element may fail, since the element may vanish inbetween. |
61 removing the first element may fail, since the element may vanish inbetween. |
61 In general, never trust the value as returned by the size/isEmpty messages. |
62 In general, never trust the value as returned by the size/isEmpty messages. |
62 |
63 |
63 |
64 |
64 [author:] |
65 [author:] |
65 Claus Gittinger |
66 Claus Gittinger |
66 |
67 |
67 [See also:] |
68 [See also:] |
68 WeakArray WeakValueDictionary WeakIdentitySet |
69 WeakArray WeakValueDictionary WeakIdentitySet |
69 " |
70 " |
70 ! ! |
71 ! ! |
71 |
72 |
72 !WeakIdentityDictionary methodsFor:'accessing'! |
73 !WeakIdentityDictionary methodsFor:'accessing'! |
73 |
74 |