Bug 17573 – Make opCmp more flexible

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-29T19:24:53Z
Last change time
2024-12-13T18:52:55Z
Assigned to
No Owner
Creator
Anders Halager
Moved to GitHub: dmd#19270 →

Comments

Comment #0 by halager — 2017-06-29T19:24:53Z
The way custom comparisons are currently implemented force you to always return an integer and doesn't tell you what operation you are doing. An example of how it can bite is that mir can't do elementwise comparisons similar to how it does addition or multiplication since it has to return an int for comparisons. So a + a == [2, 2, 2] and a * a == [1, 1, 1] but you can't express a < a == [false, false, false]. I get the logic of only making the user create a single comparison function but maybe a possible fix would be to check if there is an opBinary for the relevant comparison operator before doing the usual opCmp logic.
Comment #1 by robert.schadek — 2024-12-13T18:52:55Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19270 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB