Re: [RFC][VOTE] Objects as Keys
| From: | Stanislav Malyshev | Date: | Wed, 17 Dec 2014 17:03:54 +0000 |
| Subject: | Re: [RFC][VOTE] Objects as Keys | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79787@lists.php.net to get a copy of this message | ||
Hi!
> As I said in the original discussion: this RFC is actually about having
> an implicit call to __hash() whenever an object is used as an array key.
> You can achieve exactly the same in userland with an explicit call.
It's like nobody have ever seen __toString before... Of course you can
do that 10-line boilerplate that Rowan outlined. The whole point of this
RFC is so you don't have to do the boilerplate.
> I would rather wait (maybe indefinitely) to have a proper implementation
> of objects as keys than have this compromise.
I have hard time to understand this - it's like somebody offering to
give you $100, with no conditions, and you say "no, I'd rather wait for
somebody giving me a billion dollars, until then I won't take the $100".
Having object as keys does not contradict this RFC in any way - though
the probability of it happening in PHP 7 is pretty much nil so you'd
have to wait at least several years, but most probably - forever. So you
pretty much choosing to have nothing over having something with no
upside at all. Why?
--
Stas Malyshev
smalyshev@gmail.com