Hi!

> I wrote https://wiki.php.net/rfc/comparable a couple of years ago —
> there's a patch there that would probably still apply without too much
> work to master. About the only difference was that I didn't double
> underscore the magic method (in line with both Java and PHP interfaces
> like Countable).

Overriding < and > isn't the biggest issue, even though BC issues with
conversions may definitely be a surprise. Bug biggest one is ==, which
may have a lot of very non-trivial effects if you make == return
"equals" when other functions (such as searches, hashes, etc.) may treat
them as not equal. It is quite a complex thing which is rife with
unexpected side effects, so I think it would be better if it were explicit.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to