IntervalArithmetic.jl icon indicating copy to clipboard operation
IntervalArithmetic.jl copied to clipboard

Don't export ∞

Open dlfivefifty opened this issue 5 years ago • 8 comments

InfiniteArrays.jl has as a special type, which conflicts with the exporting of from this package. I think the best solution is to not export from here, as there already exists Inf and the definition is not directly related to interval arithmetic.

dlfivefifty avatar Mar 15 '19 09:03 dlfivefifty

Thanks for the report. That's a good point. I guess we should unexport then. Is there a simple way of importing it again? I guess we could just make a submodule called IntervalArithmetic.SpecialSymbols or similar.

Isn't there also a clash of .. with one of your packages? It also clashes with IntervalSets, which is used e.g. in Makie. I'm not sure what the general solution for such situations is.

dpsanders avatar Mar 24 '19 01:03 dpsanders

I use IntervalSets.jl, so yes that would also be good to coordinate. I don't know a good solution other than type piracy, which maybe is OK.

dlfivefifty avatar Mar 24 '19 21:03 dlfivefifty

I think a solution to this is to make a submodule IntervalArithmetic.Symbols or IntervalArithmetic.Special (or whatever) that exports and .., and not export them by default, even though that will be a pain.

Any thoughts @lbenet ?

dpsanders avatar Apr 15 '19 01:04 dpsanders

I think that can be moved to a submodule of symbols for IntervalArithmetic.jl.

A true solution to that would be to have a common that is more special that Inf currently is, such that it means different things depending on the context. In particular it should be usable as an index for InfiniteArrays.jl and be considered a Float in IntervalArithmetic.jl (I don't know if there are other use cases). However I'm not sure about the feasibility of this.

IntervalSets.jl and IntervalArithmetic.jl seem to be mutually exclusive, so users should probably use explicit import statement rather than using. A possibility to still have it is to allow setting ENV["IA_EXPORT_SYMBOLS"] to false before building the package and not exporting additional symbols like or .. in that case.

Kolaru avatar Apr 15 '19 15:04 Kolaru

I think we can simply have unexported; speaking for myself, this is a symbol I don't use too often.

However, we should have .. at disposition, because it is incredibly handy; same for ±. So at the moment, I wouldn't do anything on them. As @dlfivefifty says, and is encouraged here, for the time being we could live with some type piracy.

lbenet avatar Apr 15 '19 16:04 lbenet

IntervalSets.jl README is actually suggesting that a..b still return an IntervalSets.ClosedInterval, and that IntervalArithmetic.jl does type piracy by overloading +, -, sin, etc.

dlfivefifty avatar Apr 15 '19 16:04 dlfivefifty

cc @yashrajgupta

dpsanders avatar Aug 09 '19 20:08 dpsanders

Related proposal https://github.com/JuliaLang/julia/issues/45475

petvana avatar May 30 '22 10:05 petvana