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

RFC: add the ability to disable syntax deprecation warnings #9294

Merged
merged 1 commit into from
Dec 15, 2014

Conversation

jakebolewski
Copy link
Member

Adds the ability to turn off syntax deprecations in the parser with a command line flag --no-depwarn or at runtime:

julia> a = {1,2,3}
WARNING: deprecated syntax "{a,b, ...}".
Use "Any[a,b, ...]" instead.
julia> a = {1,2,3}

WARNING: deprecated syntax "{a,b, ...}".
Use "Any[a,b, ...]" instead.
3-element Array{Any,1}:
 1
 2
 3

julia> Base.syntax_deprecation_warnings(false)
false

julia> a = {1,2,3}
3-element Array{Any,1}:
 1
 2
 3

@ivarne
Copy link
Sponsor Member

ivarne commented Dec 10, 2014

Great!
Shouldn't this disable deprecation warnings from @deprecate too?

@@ -241,3 +241,18 @@ end

warn(err::Exception; prefix="ERROR: ", kw...) =
warn(sprint(io->showerror(io,err)), prefix=prefix; kw...)

# Julia compiler options struct
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment that this mirrors the jl_compileropts_t struct from julia.h

@jakebolewski
Copy link
Member Author

I need to change the names a bit to better reflect that this is only for syntax deprecations.

@ivarne
Copy link
Sponsor Member

ivarne commented Dec 10, 2014

Why not add a check in on the compileropts().no_depwarn flag in depwarn, so that it works for @deprecated warnings too.

edit: updated placement suggestion.

@jakebolewski
Copy link
Member Author

Ok I've expanded this to methods as well. I really just need a run time way to turn of syntax deprecation warnings in the frontend, but I could see how turning off method deprecations would be useful.

@ivarne
Copy link
Sponsor Member

ivarne commented Dec 11, 2014

I tried to do a small cleanup (no reason to collect the bt if we're not going to warn) if the depwarn funtion in @deprecate in ac0ef2f, but there seems to be a problem with the struct member naming. On the Julia side it is calld no_depwarn, but on the C side it is called depwarn. Which is correct?

@timholy
Copy link
Sponsor Member

timholy commented Dec 14, 2014

👍

@jakebolewski jakebolewski force-pushed the jcb/nodepwarn branch 3 times, most recently from 18b7749 to d6b38d8 Compare December 14, 2014 15:15
@StefanKarpinski
Copy link
Sponsor Member

As I commented on the --noinline option, how about making this --depwarn=[yes|no] so that there's room for potential additional choices in the future?

@jakebolewski jakebolewski force-pushed the jcb/nodepwarn branch 2 times, most recently from 283bcc1 to 04856b7 Compare December 15, 2014 04:41
@jakebolewski
Copy link
Member Author

Ok I've updated with @StefanKarpinski's UI suggestions. I guess the only question now is if it is useful to have this as a runtime or compile time check. A compile time check would remove the performance penalty of deprecated methods, syntax deprecations could still be toggled at runtime.

The `--depwarn={yes|no}` flag turns on/off method warnings and deprecated syntax warnings
in the parser.

(unexported) `compileropts()` method added to retrieve the
compileropts struct from libjulia.

(unexported) `syntax_deprecation_warnings(::Bool)` method added to
turn off syntax deprecation warnings in the parser at runtime.
the method returns the previous syntax deprecation warning state.

add NEWS entry and update docs for command line switches
@ivarne
Copy link
Sponsor Member

ivarne commented Dec 15, 2014

This is a great performance improvement for deprecated methods anyway.

@timholy
Copy link
Sponsor Member

timholy commented Dec 15, 2014

I don't have a strong opinion. If there's still some performance hit it will act as encouragement to update the code, which might not be a bad thing. OTOH, I imagine the use case for most people will be "I have some old code that I just need to run to finish this {presentation|paper|grant}, once that's done I'll fix the code"; for them, the ability to toggle inside a session would be irrelevant.

If you don't really care either, then you can take advantage of the new UI and wait for someone who really needs it to add a NO option (stronger than no, removes the check altogether).

@tkelman
Copy link
Contributor

tkelman commented Dec 15, 2014

This is failing on appveyor and locally on Win64 due to #9366, it doesn't need to be restarted.

jakebolewski added a commit that referenced this pull request Dec 15, 2014
RFC: add the ability to disable syntax deprecation warnings
@jakebolewski jakebolewski merged commit e93672d into master Dec 15, 2014
@ivarne ivarne deleted the jcb/nodepwarn branch December 15, 2014 13:50
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 this pull request may close these issues.

None yet

5 participants