> On Tue, Dec 16, 2014 at 9:39 AM, Matteo Beccati <p...@beccati.com> wrote:Hi Guilherme, > >> On 16/12/2014 12:34, Guilherme Blanco wrote: >> Hi, >> All I can say is that the lack of this feature is one of the main reasons why Doctrine doesn't fully work with composite keys. >> With this enhancement it would now become possible to implement a proper IdentityMap. > >Are you sure you haven't misinterpreted the RFC?
Hi Matteo, I did not. You may think I mentioned IdentityMap as entity map, but I'm talking about entityPersister mapping or resultPointers consumptions that happens inside Doctrine throughout the execution. Entity IdentityMap is enough to use purely spl_object_hash(). We should focus on the main goal here, which is complex structures as keys. As a very complex library developer I do see lots of use cases for this. []s, On Tue, Dec 16, 2014 at 6:52 PM, Rowan Collins <rowan.coll...@gmail.com> wrote: > > On 16 December 2014 18:50:06 GMT, Stanislav Malyshev <smalys...@gmail.com> > wrote: > >Hi! > > > >> Explicit conversion is trivial, just call whatever method you like. > >> Sure, you can't write (int)$obj, but $obj->toInt() is just as > >> expressive. > > > >Exactly the same applies to __toString and whole ArrayAccess, yet we > >still have them. Avoiding boilerplate code helps. Especially if > >boilterplate code would look like: > > > >if(is_object($foo)) { > > $foo_key = $foo->toInt(); > >} else { > > $foo_key = $foo; > >} > >$a[$foo] = 1; > > > >Doing it each time is annoying. > > I was just confused by your statement that "explicit conversion is > inacessible from userspace". But yeah, I guess with string keys you can > just write $a[(string)$foo] and assume/hope it will do something meaningful > whatever the type of $foo. > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco MSN: guilhermebla...@hotmail.com GTalk: guilhermeblanco Toronto - ON/Canada