Hi,

On Fri, Sep 9, 2011 at 10:14, Nicolas Grekas
<nicolas.grekas+...@gmail.com>wrote:

>
> I don't understand how the code you just gave would be useful in practice?
>>
>
> Is that question for me ? If yes, which code are you talking about ?
>

> $pseudoWeakMap = array();
> $pseudoWeakMap[spl_object_**hash($obj)] = new WeakReference($obj);


>
> I've implemented a WeakMap class in the weakref pecl ext, see:
>>
>
> For ref: 
> https://github.com/colder/php-weakref/blob/master/tests/weakmap_001.phpt
>
>
> I believe this better fit people's needs. Or did you have something else in
>> mind?
>
>
> Talking for me, that's cool !
>
> Just one question about the interface :
> Javascript interface is based on a setter/getter rather than any kind of
> ArrayAccess.
>

I could easily create a method alias get/set, if needed.


> Does anybody has an idea if on this case, about ArrayAccess vs
> setter/getter ?
> For example, wouldn't people expect "foreach" to work when $wm[] access is
> possible ?
> Personally, I like the current syntax, it's short. I'm just wondering of
> any corner case exists?
>

I'll probably make it iterable in the future, yes.

Best,


>
> Nicolas
>



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

Reply via email to