[Issue 17418] New: opCmp return value unclear

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 22 06:42:40 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17418

          Issue ID: 17418
           Summary: opCmp return value unclear
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: mathias.baumann at sociomantic.com

When implementing an opCmp, I pretty much always need to look up how it is
defined and the specification constantly disappoints but not saying a word of
what the function should actually return for which case.

you can kind of extract that info from the re-write rules, but why make it so
difficult and not just say something like

RETURN   A   B
   -1    2   1
    0    2   2
   +1    1   2

(or whatever the correct numbers are)

Link to unclear definition:

http://dlang.org/spec/operatoroverloading.html#compare

--


More information about the Digitalmars-d-bugs mailing list