Re: [RFC] Using objects as keys
| From: | Michael Wallner | Date: | Mon, 27 Oct 2014 08:33:44 +0000 |
| Subject: | Re: [RFC] Using objects as keys | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78380@lists.php.net to get a copy of this message | ||
On 27/10/14 08:09, Stas Malyshev wrote:
> Hi!
>
>> I don't like this, mainly because it blocks a future direct use and storage
>> of objects as keys in an array, i.e. what SplObjectStorage does.
>
> It does not. It just allows the objects to control how they are seen
> when they are used as keys in regular PHP arrays. That does not prevent
> SplObjectStorage or anything else from doing whatever one wants. I
> personally would say SplObjectStorage probably should respect __hash if
> provided, but we can discuss it separately.
Do we want to consider to let core use spl_object_hash() if ::__hash()
is not implemented, so objects can always be used as keys?
--
Regards,
Mike