
On Wed, Jul 20, 2011 at 23:53, Richard O'Keefe
On 21/07/2011, at 9:08 AM, Paul Johnson wrote:
I would have thought that the compiler, as a matter of optimisation, could insert a check to see if (==) is comparing an object with itself. The only way I can see this breaking is with perverse instances of Eq that would return False for "f == f".
Presumably inside the body of f, x and x would be identical pointers, but the only right answer is False, not True.
If you think this is a bit far fetched, consider the IEEE definition of equality for floating-point numbers:
let x = 0.0/0.0 in x == x
The answer is False, so the optimisation breaks down even with a system-defined type.
Also, NaNs are never equal to each other. Also consider SQL's NULL (relevant if you use Takusen, I suspect). -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms