Re: [RFC] Using objects as keys
| From: | Matteo Beccati | Date: | Tue, 28 Oct 2014 14:04:05 +0000 |
| Subject: | Re: [RFC] Using objects as keys | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78425@lists.php.net to get a copy of this message | ||
Hi Stas,
On 27/10/2014 18:39, Etienne Kneuss wrote:
> I think it should be made clear that what the target of your RFC is not to
> support objects as keys, what you propose instead is an implicit
> translation from:
>
> $a[$obj]
> to
> $a[$obj->__hash()]
>
> This is clearly different.
I agree the RFC should make it very clear that foreach, key(),
array_keys(), etc. will just return the hash, not the object instance.
I for one was a bit confused and couldn't tell if that was the case
after reading the entire RFC.
Cheers
--
Matteo Beccati
Development & Consulting - http://www.beccati.com/