-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
typeassert syntax deprecations #17445
Conversation
will doing what this deprecation says and adding |
that's exactly the intent. this adds a deprecation to those codepaths, but doesn't change their behavior |
@@ -1,11 +1,11 @@ | |||
# This file is a part of Julia. License is MIT: http://julialang.org/license | |||
|
|||
function convert(::Type{Float32}, val::Float16) | |||
ival::UInt32 = reinterpret(UInt16, val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this also deprecate this form, or did you just add local
because you're deprecating the no-assignment form used for ret
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code just looked silly with only local on the ret
declation. I didn't deprecate this form, since it's not clear to me that is decided.
I thought the idea was that Why do you want |
very hard to grep for this in packages, and the warning is kind of confusing when you do
|
and from
the double warning is also confusing |
no kidding, but that's a fairly accurate report on what this code used to mean. because you don't have an assignment to
yes, that's pretty much the entire point behind this deprecation |
I think it's more consistent to be either a syntax error or an implicit declaration. The current meaning of a type-assert on the old value seems least useful to me, although it is consistent with the current behavior for mutating assignments such as global x
x::T = 1 |
the deprecation warning should say - the syntax used in the code is deprecated, and what to replace it with. right now it does neither, the warning includes keywords that the user code did not. |
we don't have good tracking in the scheme code of what the user input, I can add that the user should use typeassert instead. |
@vtjnash: I think that a syntax error for Quoting @StefanKarpinski from #16071:
I think that we should reduce the confusion to a minimum and only declare typed variables using |
a943c92
to
1a0cdfc
Compare
the lack of line numbers for these warnings is really a bummer (sorry about the repeat posts, phone being stupid) |
@vtjnash: I think we need to make a go/no go decision on this change today. Personally, I think that we should deprecate this, but I'm not sure that it's a great idea to rush the deprecation into a release right at the very end of the process. This would be a perfectly acceptable deprecation to do early in the next release cycle. |
preferably with line numbers if at all possible, so people aren't at a complete loss about what they need to fix |
@tkelman the nice thing about error reporting features is that they can be added during the RC. the other nice thing about them is that they should not be added in the same PR as a feature decision. |
Can you clarify this? I don't think this'll have much of an impact on packages, since it's also not a common idiom in base. It's also not the same as adding a feature, since this is purely just deprecating old syntax by adding warnings whenever that codepath is active. |
Putting anything into a release right at the end is kind of sketchy. |
good point about separation of concerns, but with the current state of the error reporting, doing this now is a net negative. any deprecation will be noticed, base idioms don't really correlate with idioms used in packages. |
I think it's ok to keep I don't think we should have a deprecation warning at all for |
Any opinion on whether |
Yes, let's leave it for now to focus this change on the most urgent part. |
1a0cdfc
to
932b93a
Compare
I'll do NEWS and doc updates for this. |
deprecate `x::T` as type declaration syntax, ref JuliaLang#16071 deprecate `x::T = 0` where x is global and `global x::T` meaning typeassert, ref JuliaLang#964 also fix a bug where a typeassert was considered to be effect-free, causing it to be quasi-converted into a local variable declaration fix a bug in env.jl where a typeassert was intended
deprecations for #964 and #16071
this will let us reuse
global x::T
andx::T = 1
to mean a typed global instead of the current meaning oftype-assert
it will also let us reuse
x::T
(in statement position) to always mean typeassert, instead of sometimes meaning local variable declaration (depending on various positional and context rules)