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

Constructor of Interval inherently type unstable? #180

Open
KristofferC opened this issue Nov 5, 2021 · 1 comment
Open

Constructor of Interval inherently type unstable? #180

KristofferC opened this issue Nov 5, 2021 · 1 comment

Comments

@KristofferC
Copy link
Contributor

KristofferC commented Nov 5, 2021

It seems impossible to create an interval (closed, open) in a type stable manner:

julia> @code_warntype Interval{Int,Closed,Open}(1, 2)
...
Body::Union{Interval{Int64, Closed, Open}, Interval{Int64, Open, Closed}}

It seems very strange that a constructor with all parameters specified could return a different type. That behavior seems deprecated though:

elseif l f
# Note: Most calls to this inner constructor will be from other constructors
# which may make it hard to identify the source of this deprecation. Use
# `--depwarn=error` to see a full stack trace.
Base.depwarn(
"Constructing an `Interval{T,X,Y}(x, y)` " *
"where `x > y` is deprecated, use `Interval{T,Y,X}(y, x)` instead.",
:Interval,
)
return new{T,R,L}(l, f)

Could there be a release with that deprecation removed?

@omus
Copy link
Collaborator

omus commented Nov 5, 2021

The deprecated changes in Intervals have been around for a good amount of time now and I'm definitely onboard with making a breaking release to clear them out.

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

No branches or pull requests

2 participants