Comment #0 by qs.il.paperinik — 2020-12-04T03:17:11Z
https://dlang.org/spec/operatoroverloading.html#compare says:
> Both rewrites are tried. If only one compiles,
> that one is taken. If they both resolve to the
> same function, the first rewrite is done. If
> they resolve to different functions, the best
> matching one is used. If they both match the
> same, but are different functions, an
> ambiguity error results.
This is not true. Comparison should *never ever* depend on the order of arguments, i.e. x < y should in all cases be equivalent to y > x. Programmers largely expect those to be equivalent in action the only difference being style or readability.
All compilers since 2.060 accept this basic code [1] while clearly the spec says the compiler must issue an ambiguity error (and the spec is right about that).
[1] https://run.dlang.io/is/V3LrEU
Comment #1 by robert.schadek — 2024-12-13T19:13:17Z