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.

> It is also badly named, because it does NOT implement objects as keys. It
> implements deriving surrogate keys from objects when used in an array key
> context.

That's how the objects are used as keys. Storing objects in the
hashtable would really require rewriting the whole hashtable and would
probably be very inefficient as you'd have to call PHP code each time
you compare two objects in the chain. Moreover, modifying such objects
would probably create havoc. So having an immutable value sounds like
the best solution for the practical use cases.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to