On 26/09/14 08:36, Stas Malyshev wrote:
>> I think it makes more sense than a new method on all objects. You could
> Nobody talks about "new method on all objects" (it's also not really
> possible in PHP). We're talking about new magic method, which allows the
> developer to control how class is treated when used as hash key. Note it
> is not always the same as object's identity - you may want two GMP
> numbers with value of "1" actually refer to the same key in the hash,
> just like two numbers 1 do.

This is actually the one I'm trying to work around ...
The key is well defined as it's the BIGINT value on the database but I
am unsure exactly what is going on with all the discussions on 64 bit
processing if the same integer key will be available on 32bit builds.
Which is where what other 'hash/simple assign' methods return is
something that would be nice to know.

For different builds to produce completely different results is a
problem, but since in my book __toString() simply needs to be manually
populated anyway, populating it with something suitable is not a
problem. I don't see how anything 'memory location' based makes a
sensible default for that? Automatically populating with something
content based is simply not practical? So adding a __toHash does not
provide any gain since it has the same problem?

The main advantage of PHP is that it IS loosely defined so we can bend
it to our own way of working, so some 'defaults' would be better as
simply better documented explanations on why manual assistance is more
appropriate. __toString() is one of those cases.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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

Reply via email to