On Friday, 25 July 2014 at 10:10:50 UTC, Daniel Murphy wrote:
"Jonathan M Davis" wrote in message
news:[email protected]...
The compiler _never_ defines opCmp for you. You have to do
that yourself. So, what you're suggesting would force people
to define opEquals just because they defined opCmp unless they
wanted to take a performance hit <<<<<<<< in the rare case
that it actually matters >>>>>>>>>>.
Equality checks are a common operation, so it will affect a fair
bit of code. Granted, how much it will really matter is an open
question, but there will be a small reduction in speed to quite a
bit of code out there.
But regardless of whether the efficiency cost is large, you're
talking about incurring it just to fix the code of folks who
couldn't be bothered to make sure that opEquals and
lhs.opCmp(rhs) == 0 were equivalent. You'd be punishing correct
code (however slight that punishment may be) in order to fix the
code of folks who didn't even properly test basic functionality.
I see no reason to care about trying to help out folks who can't
even be bothered to test opEquals and opCmp, especially when that
help isn't free.
- Jonathan M Davis