Am 05.08.2011 18:29, schrieb Hannes Landeholm:
It's interesting to think about though.
I'd definitely find a use for them;) I might just patch our installations to provide me with the zval-refcount and go with that for now...I have been warned, but I have to burn myself before I believe that boiling water is hot;)
I just thought of another design-pattern which could make use of WeakReferences...The composite design pattern.
http://en.wikipedia.org/wiki/Composite_pattern
A parent references its childs and each child references its parent. circular-reference nightmare...with WeakReferences I could use a weakReference for storing the parent...so that if the parents last real reference is discarded the childs will cleaned out as well.