Hello all,

  and thanks Stas for the explanations.

Monday, July 2, 2007, 7:52:03 PM, you wrote:

>>  We could add a counter that gets incremented for each object that is
>>  created and associate that number with the object. Wouldn't that solve
>>  the problem (if there is one)?

> It would solve it, but it would require modifying each extension dealing 
> with objects in order to register all objects in this global registry 
> and of course it would require adding another value into object 
> structure. I'm not sure having running numeric ID is that important.

> If you just need to know if two variables are the same object, you have 
> ===. If you need to index by it, you have the hash.

Exactly. And the index should not be dependant on the contents of the
properties. Also you should always use the shortest unique ID. In our case
as very well explained it is handler plus id. What we could do to prevent
two different objects getting the same hash is to ask for the memory
location....but the we cannot use the zval container as multiple zval
containers might point to the same object. Nor can we really use the object
location in its object storage as we do not know if that is safe. Thus we
could only add an independent counter which imo is pretty bad and as
epxplained it would created overly complex overhead.

Now what you actually want with the hash is indexing. That probably means
storing the object in whatever holds the index - maybe an array. Maybe
something else. Either way no other object can get the same hash as the
object is stored and thus no other objetc can get the same handler,id combo
at the same time. So i do not see any issue here. If you guys want it more
complex i suggest you extend the hash in userland and add a special
property/interface solution.

Best regards,
 Marcus

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

Reply via email to