On 24 Sep 2014, at 21:08, Stas Malyshev <smalys...@sugarcrm.com> wrote:
> The hash doesn't have to be a nonsensical hex value, it can be something > like "My Object Number 42" if you want to. The difference is that > __toString is for human reading, and it's not always suitable for > hashing purposes. Just read the docs on any of the languages that have > separate hash method - they all have the same argument, there's a > different between printing an object for output and using the object as > a key. Actually, yeah, I see your point. I suggest this, then: public function __toKey() : int | string {} Psuedo-code, since you can’t have multiple return types. I think it’s a better name than __hash (fits well with __toString IMO), and this way we can support integer keys too, where that makes sense. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php