On Thu, 2014-10-23 at 12:44 +0400, Dmitry Stogov wrote: > this won't completely solve the problem, because array keys won't be > UString anymore.
http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode() Others solve this problem in exactly this way, the Java implementation requires that you return an int. The one in that draft will allow you to return any scalar. This is much more suitable for PHP. It doesn't solve the problem directly but allows the programmer to solve it for themselves, just like Object.hashCode in Java. > > Thanks. Dmtiry. > > > On Thu, Oct 23, 2014 at 12:11 PM, Joe Watkins <pthre...@pthreads.org> > wrote: > On Tue, 2014-10-21 at 10:30 -0700, Stas Malyshev wrote: > > Hi! > > > > > I wish there was a way for specific objects to opt into > this. > > > > There will be, if __hashKey() or whatever would be the > properly > > bikeshedded name, becomes reality as discussed elsewhere. It > shouldn't > > be hard to do and it's exactly what many other languages do > when trying > > to use objects as keys for maps. > > > > > > Not ready for discussion yet ... > > https://wiki.php.net/rfc/hashkey > > But it exists, I think it solves a problem for ustring in > particular but > it solves the problem in general too. No time to write about > it or > discuss it at this moment, but in pipeline, hopefully ... > > Cheers > Joe > Cheers Joe -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php