D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23553 - opCmp spec is incomplete
Summary: opCmp spec is incomplete
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2022-12-13 14:40 UTC by Grim Maple
Modified: 2022-12-16 16:14 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Grim Maple 2022-12-13 14:40:02 UTC
The spec page for `opCmp` (https://dlang.org/spec/operatoroverloading.html#compare) doesn't tell what values should be returned from it
Comment 1 Dennis 2022-12-13 15:47:05 UTC
It shows a table with rewrites such as: 

a < b   |   a.opCmp(b) < 0

Doesn't that tell you that it should be a negative number when a < b?
Comment 2 Grim Maple 2022-12-13 19:20:17 UTC
Apparently, it was obscure enough for me to not figure this out. Maybe, a rephrase is needed, or an added table of what the function should return.
Comment 3 mhh 2022-12-13 20:25:35 UTC
I agree with Grim. Existing lowering docs is fine but an example even more fine
Comment 4 Dlang Bot 2022-12-16 07:56:12 UTC
@RazvanN7 created dlang/dlang.org pull request #3474 "Fix Issue 23553 - opCmp spec is incomplete" fixing this issue:

- Fix Issue 23553 - opCmp spec is incomplete

https://github.com/dlang/dlang.org/pull/3474
Comment 5 Dlang Bot 2022-12-16 16:14:45 UTC
dlang/dlang.org pull request #3474 "Fix Issue 23553 - opCmp spec is incomplete" was merged into master:

- 48263a38d0b9491c07361c9b7e6b22625d1ecb14 by RazvanN7:
  Fix Issue 23553 - opCmp spec is incomplete

https://github.com/dlang/dlang.org/pull/3474