On Jun 3, 2006, at 6:12 PM, Jasper Bryant-Greene wrote:
I would imagine that __hash() or whatever it is called would be defined
on all objects and implemented internally in PHP, and would simply
generate some internal hash that is unique for all objects.

That might work for initial testing, but applying that sort of hash function to objects identified purely by strings, to take one example, doesn't work. (in_array(new Str("A"), array(new Str("A"))) is one failure mode that comes instantly to mind. It's inevitable that two non-identical objects would contain identical data. Think of the reasons behind C++'s operator==, or for those of you familiar with Carbon programming under MacOS, the hash callbacks provided by CoreFoundation's various container types.

Gwynne
SkyTag Software

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

Reply via email to