Re: [VOTE] Weak References

From: Date: Fri, 09 Sep 2011 13:49:22 +0000
Subject: Re: [VOTE] Weak References
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-55333@lists.php.net to get a copy of this message
Hi, On Fri, Sep 9, 2011 at 10:14, Nicolas Grekas <nicolas.grekas+php@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

« previous php.internals (#55333) next »