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

Avoid overloading Base.union, Base.intersect and Base.contains #172

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

Joel-Dahne
Copy link
Collaborator

Apart from Flint 3.0 this is the last change I mention in #165. It avoids overloading Base.union, Base.intersect and Base.contains and instead provides Arblib.union, Arblib.intersection and Arblib.contains.

For the motivation see #165. In short Base.union and Base.intersect treats numbers as singleton vectors, which is different from the Arb behaviour. For contains the problem is not as severe, but I still think keeping the Arb version separate is a good idea. See also this PR for IntervalArithmetic.jl where they also opt to not overload the Base methods.

This change is of course not backwards compatible and it is likely code will need to be updated (this is certainly true in my case). For union and intersect this is slightly annoying because they will now use the Base implementation and return a vector, so the error will only be noticed further down the line. Mentioning it in the release notes will hopefully reduce the issues people encounter.

For some of the motivation see #165. The main reason is that the union
and intersect methods in Base treat numbers as singleton containers,
which is different from the Arb versions.
Also use that intersection! returns non-zero on failure, this avoids
checking overlap separately.
@kalmarek kalmarek merged commit 4ae7c48 into master Oct 26, 2023
13 checks passed
@kalmarek kalmarek deleted the avoid-overloading branch October 26, 2023 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants