Hi,

On Sat, Sep 3, 2011 at 19:21, Nicolas Grekas
<nicolas.grekas+...@gmail.com>wrote:

> >
> > $pseudoWeakMap = array();
> > $pseudoWeakMap[spl_object_**hash($obj)] = new WeakReference($obj);
> >
> > or did I misunderstand the concept? I hope I'll have a chance to use
> > WeakReferences soon in my project;)
>
>
>
> I also believe that this is the logic, but from the doc, when an object is
> destroyed, its hash may be reused for other objects.
> So this implementation could possibly have bad side effect, isn't it ?
>
> Nicolas
>

I don't understand how the code you just gave would be useful in practice?


I've implemented a WeakMap class in the weakref pecl ext, see:

http://svn.php.net/viewvc/pecl/weakref/trunk/tests/weakmap_001.phpt?revision=316293&view=markup

for an example of usage.

I believe this better fit people's needs. Or did you have something else in
mind?

Best,

-- 
Etienne Kneuss
http://www.colder.ch

Reply via email to