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

make _ by itself emit a deprecation warning #20526

Closed
wants to merge 1 commit into from

Conversation

StefanKarpinski
Copy link
Member

Handle missing case in #20328. This change makes the way deprecation warnings get printed a bit inconsistent:

julia> _ = 1
1

julia> _
WARNING: deprecated syntax "_ as an rvalue".
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:62
 [2] eval(::Module, ::Any) at ./boot.jl:236
 [3] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [4] macro expansion at ./REPL.jl:97 [inlined]
 [5] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
1

julia> _
1

julia> _,

WARNING: deprecated syntax "_ as an rvalue".
(1,)

julia> _,

WARNING: deprecated syntax "_ as an rvalue".
(1,)

This path calls depwarn which prints a proper backtrace and only prints the first time. The other path just prints the warning with no backtrace or color and prints every time.

@JeffBezanson
Copy link
Member

I don't think this is the correct implementation. We don't want to deprecate eval(:_), just the syntax _, in my opinion at least.

@StefanKarpinski
Copy link
Member Author

Ok, I'll let you take a crack at that then. I can close this PR.

@tkelman tkelman deleted the sk/dep_more branch February 9, 2017 00:11
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.

2 participants