> I would like to present to your attention an RFC about using object as keys: > > https://wiki.php.net/rfc/objkey
A few points I have against this proposal, as I understand it: - It does not store the object, only the result of `__hash`. Without the actual object this is not helpful for any use-case I have. - Using a method in the object prevents you from hashing on different members of the objects for different uses. For example, there is a User object. Most of the time the User::id will be used for the hash. However, sometimes the hash needs to be on User::username. If the hashing code is pushed inside the object and call it automatically then you can't hash on the different values. In summary 1) the hashing function should be external to the object, 2) should not be invoked magically, and 3) the object needs to be stored. This can already be done in user-land; here is one such example that I have created but there are others: https://github.com/morrisonlevi/Ardent/blob/master/src/HashMap.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php