-
Notifications
You must be signed in to change notification settings - Fork 154
prevent adding methods to the functions > and >=
#771
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
Conversation
As documented, the intended way to implement `>` is to add a method to `<`. Similarly with `>=`. A package should never add a method to either `>` or `>=`.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #771 +/- ##
=======================================
Coverage 89.82% 89.82%
=======================================
Files 11 11
Lines 1032 1032
=======================================
Hits 927 927
Misses 105 105 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
devmotion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! The reason for these unnecessary definitions is that up until recently x < y for Dual numbers was not equivalent with !(x >= y). I fixed this in #695 but apparently did not clean up the code.
src/dual.jl
Outdated
| # BINARY_PREDICATES = Symbol[:isequal, :isless, :<, :>, :(==), :(!=), :(<=), :(>=)] | ||
| # Not a minimal set, as Base defines some in terms of others. | ||
| for pred in [:<, :>] | ||
| for pred in [:<] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With only a single element in pred, the loop and the @eval below are not needed anymore. Can you remove them?
|
This change decreases the unique invalidation count upon Instructions to reproduce this result:
Data on each invalidation: |
As documented, the intended way to implement
>is to add a method to<. Similarly with>=. A package should never add a method to either>or>=.