Re: [RFC][VOTE] Objects as Keys

From: Date: Tue, 16 Dec 2014 11:46:08 +0000
Subject: Re: [RFC][VOTE] Objects as Keys
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-79720@lists.php.net to get a copy of this message
Am 16.12.2014 12:36 schrieb "Matteo Beccati" <php@beccati.com>: > > On 16/12/2014 11:52, Andrea Faulds wrote: >> >> I was previously in favour of this, but it’d prevent actual indexing >> by objects in future, and I can’t think of any use cases which aren’t >> better solved by explicitly converting to a string/integer. > > That's precisely the same reason why I voted Nay. And I wouldn't have been able to put it down in words better than Andrea did. That was my thought initially, too. But I think it is wrong. If PHP ever gets around to provide objects-themselves-as-array-keys support, it can easily do that 1) only if the object does not have such a __toKey() method, or 2) if the object has one, but it returns the object itself (which is forbidden now by the RFC) best regards Patrick

« previous php.internals (#79720) next »