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

Export interval type #163

Closed
KronosTheLate opened this issue Mar 16, 2021 · 5 comments · Fixed by #176
Closed

Export interval type #163

KronosTheLate opened this issue Mar 16, 2021 · 5 comments · Fixed by #176

Comments

@KronosTheLate
Copy link

When starting up this package, my intuitive approach would be this:

julia> using IntervalRootFinding

julia> f(x) = x^2-4
f (generic function with 1 method)

julia> roots(f, 0..10)

but, as you probably well know, this returns

ERROR: UndefVarError: .. not defined
Stacktrace:
 [1] top-level scope at REPL[5]:1

Would it be a problem for IntervalRootFinding to export the Interval type to make what I concider intuitive work, without having to add using IntervalArithmetic?

To rephrase the problem:
It feels weird to me that one has to import the interval type from IntervalArithmetic when using a package called IntervalRootFinding - the latter package obviously works with intervals, and it would therefore be natural for it to export the Interval-type on its own.

@dpsanders
Copy link
Member

That is a good idea, yes. We just have to make sure that there is no problem if you also explicitly import IntervalArithmetic.jl.

Originally the idea was for ValidatedNumerics.jl to reexport all of this functionality. I think we should maybe pick up that idea again.

@KronosTheLate
Copy link
Author

Making sure there is no problems sounds like a good approach ^_^

Would it then work so that all the packages in this ecosystem import ValidatedNumerics.jl as a dependency, and ValidatetNumerics.jl then exports all the common interface? This question is more for my curiosity than anything else.

@dpsanders
Copy link
Member

No, ValidatedNumerics just reexports everything from each package.

This is already done here but it is hard to keep track of the versions.

cc @lucaferranti

@lucaferranti
Copy link
Member

lucaferranti commented Apr 28, 2021

One package to rule them all, One package to find them,
One package to bring them all, and in the REPL bind them,

As far as I know, at the moment the only issue with importing all packages is that both IntervalRootFinding and IntervalConstraintProgramming export Contractor. That could be easily fixed as proposed in #128. A more thoughtful solution might be what discussed here

The repo seems a little outdated (no Project.toml, old workflow). I can update the repo later today.

The CompatHelper will make keeping track of the versions much easier.

@lucaferranti
Copy link
Member

lucaferranti commented Apr 29, 2021

@KronosTheLate ValidatedNumerics has been updated and the new version is released, so it should be ready to go.

Now by doing using ValidatedNumerics you have automatically access to all functionalities of all JuliaIntervals packages listed here so no need to manually import multiple packages.

There is the small caveat I mentioned above if you want to use the Contractor method from IntervalConstraintProgramming , but as far as I know that's the only issue atm. And if you need that method from ICP, you can still access that with IntervalConstraintProgramming.Contractor

@lucaferranti lucaferranti linked a pull request Aug 5, 2021 that will close this issue
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 a pull request may close this issue.

3 participants