What we really need is a get_hash_t handler on the object, so that each object knows how to hash itself. This can also come in handy when using objects as array keys.

-Andrei

On Aug 10, 2005, at 3:39 PM, Marcus Boerger wrote:

Hello Andrey,

  wrong assumption. That is only the handle but only the handle+handler
combination is unique.

marcus

Thursday, August 11, 2005, 12:32:07 AM, you wrote:

Marcus Boerger wrote:
Hello Andrey,

thanks! I wanted to do it earlier but had no idea how to sole the problem. I actually right from the beginning wanted to do all three in there. Anyway you might also want to see t he last slides of my last presentation (the one
from OSCON) which you can find here: http://talks.somabo.de/

best regards
marcus

Thursday, August 11, 2005, 12:04:37 AM, you wrote:


  Wonderful idea Helly!


Andrey



However, I think you are wrong that it cannot be implemented in user land with O(1) complexity. The following one-liner should give you a hint why I think it is possible.

[EMAIL PROTECTED]:~/test> php -r 'class a{} function get_hash_key($obj){ ob_start();
var_dump($obj); $v=ob_get_contents();
ob_end_clean();var_dump(substr($v, 7, strpos($v, "
", 11) - 7));} get_hash_key(new a);'
string(4) "a)#1"

The string is unique per object. ) and # are noise but they are not a problem.

Best wishes,
Andrey



Best regards,
 Marcus

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to