Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make opCmp more flexible #19270

Open
dlangBugzillaToGithub opened this issue Jun 29, 2017 · 0 comments
Open

Make opCmp more flexible #19270

dlangBugzillaToGithub opened this issue Jun 29, 2017 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Anders Halager reported this on 2017-06-29T19:24:53Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=17573

Description

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant