Re: [RFC] Using objects as keys
| From: | Stas Malyshev | Date: | Mon, 27 Oct 2014 18:11:48 +0000 |
| Subject: | Re: [RFC] Using objects as keys | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78398@lists.php.net to get a copy of this message | ||
Hi!
> As others noted, it also prevents a full-fledged objects-as-key
> implementation in the future.
You do realize to have such implementation we'd need to rewrite our hash
layer completely and also introduce the concept of immutable object,
otherwise changing the object would make the hash completely broken?
Which means it would probably never happen unless PHP engine is
radically rewritten.
>
> In the end it causes issues and brings very little compared to an
> explicit call to convert an object to a key.
Same as __toString obviously is useless as you could just call a method
explicitly.