On Thursday, 19 July 2018 at 10:14:34 UTC, Dominikus Dittes
Scherkl wrote:
On Wednesday, 18 July 2018 at 17:30:21 UTC, Jonathan M Davis
wrote:
On Tuesday, July 17, 2018 21:18:12 John Colvin via
Digitalmars-d wrote:
Just do what std.typecons.Proxy does and return float.nan for
the incomparable case.
Since when is that legal? I thought that it was required for
opCmp to return int. Certainly, the spec implies that it has
to be int. The fact that the compiler allows it seems like a
bug, though if Phobos is doing it, it wouldn't surprise me if
Walter would choose to update the spec rather than fixing the
compiler.
It always worked with float as returntype (at least since I'm
using D
- about 2.40 or so?), and it was necessary for the
(unfortunately
deprecated) special operators <>, !<>, <>=, !<>=, ...
The oldest reference to opCmp returning NaN that I've found is
from 2005, so it's not an entirely new thing:
https://forum.dlang.org/thread/dd3cea$26u7$1...@digitaldaemon.com
--
Simen