Hello,

> Hello Rasmus, Andi,

> [EMAIL PROTECTED] /usr/src/PHP_5_2 $ php -r 'var_dump(spl_object_hash(new
> stdClass));' string(32) "0bab1548e3b42acbcf1170617b5432ae"
> 
> For PHP 5.2 we could think about adding a hash handler to the object
> handler table and provide the above as default implementation. That
> hash handler would then be called when an object is being used as an
> offset. Maybe later in PHP 6 we can also add an interface that allows
> to overload that hash implementation. (If someone really wants that).
> Yet anything the user can overload be it an interface or magic
> function (e.g. __hashOf) seems to be too much for now.

Do you mean to allow object as indices with this default
implementation? But this implementataion cannot be overloaded? I fail
to see the needs of such things in 5.x (or 6.x even with overload).
Adding another magic method __toHash is also not what I would like.

Adding a function hash_from_object() or spl_hash_from object() to ease
the generations of hashes is indeed a good idea. There is no impact in
the objects managements and people are free to use it or not (no magic
default behaviors).

--Pierre

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

Reply via email to