Hello again:
I need to create an object's registry that keeps certain objects in a
dictionary and a second registry that keeps only objects currently in the
first registry so i thought it was a good idea to user IdentityDictionary
and WeakIdentityKeyDictionary so when the any object in the first registry
is removed then the second registry remove's it too.
Problem is that when i try to test my code, the second assertion fails. Is
there anything wrong with my test or weak collections are not suppose to
work like that?
ColonyTest>>testWeakRefs
|registry anotherRegistry object |
registry:= Registry uniqueInstance.
"this keeps weak references"
anotherRegistry := Colony new.
object:= ColonyMember new.
registry register: anotherRegistry.
anotherRegistry addMember: object.
registry register: object.
"object is into the second registry"
self assert:[ anotherRegistry contains: object].
"if we unregister this reference then the registry should lose it too"
registry unregister: object.
self deny:[ anotherRegistry contains: object]
_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users