On Mon, Oct 27, 2014 at 2:37 AM, Stas Malyshev <smalys...@gmail.com> wrote:

> Hi!
>
> I would like to present to your attention an RFC about using object as
> keys:
>
> https://wiki.php.net/rfc/objkey
>
>

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. And has at least one major drawback:

The object itself is not in the array, you cannot retrieve it by
foreach($arr as $obj => $v) { }.
=> This is quite counter-intuitive and counter-productive: one would expect
to find the object there, not its "hash".

As others noted, it also prevents a full-fledged objects-as-key
implementation in the future.

In the end it causes issues and brings very little compared to an explicit
call to convert an object to a key.

-1

-- 
Etienne Kneuss

Reply via email to