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
"invalid subtyping" breaking change in 0.6 #20949
Comments
Agree this should be added to NEWS. We can't automatically convert Could you give a bit more realistic example, to get a sense of how this is used and whether it would be useful to support? |
@JeffBezanson here are 41 examples from pkgeval (some may be duplicates due to dependencies) https://github.com/JuliaCI/pkg.julialang.org/search?utf8=✓&q=invalid+subtyping |
What I really want to know is whether those 41 cases are desirable, or if they're just bugs. Is it good to be able to define a subtype of |
That seems pretty weird and likely to be a bug, imo, but the opinion of someone more familiar with Distributions would be helpful. @johnmyleswhite? |
In my case, I had some abstract type describing "linear operators" which could act on "vectors" in a certain basis. The abstract type was However, some operators could be coded up so they could act generically on a vector in any basis, in which case they'd be defined like In reality I had three such parameters so in a bunch of places |
And I should probably mention that indeed even in 0.5 the supertype of |
Thanks for the feedback, @marius311 – it's very helpful. |
Yes, that's a helpful example. Would some arrangement like this work:
A type like |
I saw DiffEqJump and DiffEqBiological show up in the logs. Those are bugs: I meant for the abstract type to know a little bit of information to use for dispatching. I haven't dispatched off of it yet, so it didn't get caught. I like that the type system throws an error in this case now. |
Thanks, yea, that makes sense. I think your suggestion would definitely work in my case. |
See JuliaLang/julia#20949 Got this warning during installation: `WARNING: deprecated syntax "abstract Shell" at <>/.julia/v0.6/Blink/src/AtomShell/AtomShell.jl:6. Use "abstract type Shell end" instead.`
Doesn't seem like any concrete thing left to do here for 0.7. |
In 0.5 the following works,
but in 0.6 it gives "invalid subtyping in definition of bar". You can fix it by putting
immutable bar <: foo{Any}
, which afaict gives the behavior 0.5 used to.If this is intended, unless I've missed it then I think this should be mentioned in NEWS.md. I'm probably biased because this pattern appeared in my code a lot, but I would vote for it being near the top.
Actually, FWIW I thought the 0.5 version is nicer, I have lots of types with many parameters, and its getting a bit ugly to keep writing
foo{Any,Any,Any,...}
, so actually unless I missed why this is required or this is actually a bug, my vote would be to allow the old syntax.The text was updated successfully, but these errors were encountered: