Re: [RFC][VOTE] Objects as Keys

From: Date: Wed, 17 Dec 2014 20:37:45 +0000
Subject: Re: [RFC][VOTE] Objects as Keys
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-79792@lists.php.net to get a copy of this message
On 16 December 2014 at 08:34, Stanislav Malyshev <smalyshev@gmail.com> wrote: > Hi! > > I'd like to initiate a vote on "objects as keys" RFC: > https://wiki.php.net/rfc/objkey > > I know this is a holiday season but it was extensively discussed and I > think most people already formed their opinions. I've put the voting > period as 3 weeks to have some time for people to vote even with the > holidays, etc. > > The vote includes choice for the name. Vote for either name is counted > as the vote for the overall proposal, and 2/3 majority is required as > it's a language change. > > Some more expanded summary of the arguments is here: > http://php100.wordpress.com/2014/12/14/objects-as-keys/ in case > you're > interested. I've not read the whole email thread, but I have read the RFC, sorry if I missed something in the emails. I've voted no, I really don't see any benefit to automatically calling a magic method for a key, this is a kind of unintuitive magic for me. For objects as keys to be useful (in my opinion), a foreach loop or array_search must be able to return the object as the key component. The RFC doesn't offer a way to retrieve the original object from the stored hash, indeed without a refcount++ the object may not even exist any more. I honestly like the idea of "objects as keys", but this RFC doesn't offer that.

« previous php.internals (#79792) next »