-
Notifications
You must be signed in to change notification settings - Fork 195
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
Change identifer of stderr to se #368
Conversation
Codecov Report
@@ Coverage Diff @@
## master #368 +/- ##
==========================================
+ Coverage 90.39% 90.51% +0.11%
==========================================
Files 19 19
Lines 2020 2024 +4
==========================================
+ Hits 1826 1832 +6
+ Misses 194 192 -2
Continue to review full report at Codecov.
|
Seems good. |
As suggested here, how about |
The Slack channel favored |
I guess that’s a downside of trying to make decisions like this in multiple places. Slack is great for help and discussions, but the fact that the history disappears after a short while means that there’s no permanent record of how decisions like this came to be. Out of curiosity, did any of the (8) individuals who gave a 👍 on @stevengj’s comment (linked above) participate in the discussion? I still think that |
FWIW I don't think we should use |
I totally agree about Slack not being the best for these kinds of decisions. The best place probably (would have/is) an issue on StatsBase.jl This is an excerpt form the Slack discussion on the
which led to the conversation about whether to lift the ban on using two-letter functions. |
I'd actually prefer we go in the opposite direction and use a longer name for standard deviation, e.g. |
|
After a couple days of discussion in the repo, I think the consensus it to change |
src/deprecates.jl
Outdated
@@ -20,7 +20,7 @@ import Base.varm, Base.stdm | |||
@deprecate AICc(obj::StatisticalModel) aicc(obj) | |||
@deprecate BIC(obj::StatisticalModel) bic(obj) | |||
|
|||
@deprecate stderr(obj::StatisticalModel) se(obj) | |||
@deprecate stderr(obj::StatisticalModel) stderror(obj) |
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.
Maybe something like
if !isdefined(Base, :stderr)
@deprecate stderr(obj::StatisticalModel) stderror(obj)
else
@deprecate (io::IO)(obj::StatisticalModel) io === stderr ? stderror(obj) : throw(MethodErrror(io, (obj,)))
end
so that it still mostly works in 0.7.
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.
Thank you for reviewing.
The second deprecate message cause syntax error.
ERROR: LoadError: LoadError: invalid usage of @deprecate
I'm tring to fix it, but it is difficult for me.
Could you tell me how to write?
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.
You should be able to work around this limitation by doing something like:
function (io::IO)(obj::StatisticalModel)
Base.depwarn("stderr(obj::StatisticalModel) is deprecated, use stderror(obj) instead", :stderr)
io === stderr ? stderror(obj) : throw(MethodErrror(io, (obj,)))
end
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.
Thank you.
Identifer confilict stderr meaning of IO and statical.
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.
Thanks!
if !isdefined(Base, :stderr) | ||
@deprecate stderr(obj::StatisticalModel) stderror(obj) | ||
else | ||
function (io::typeof(stderr))(obj::StatisticalModel) |
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 problem with this is that typeof(stderr)
can change at runtime if redirect_stderr
is called.
So this should just be ::IO
to catch all usages. I don't think it is a problem to have a fairly general method here as a temporary deprecation since it continues to throw a MethodError for non-stderr
objects. (People are unlikely to pass StatisticalModel
objects to random IO objects by accident anyway.)
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.
I changed ::IO
because it doesn't work on 0.7. I'm not sure we should care about supporting that deprecation after calling redirect_stderr
... Anyway I don't have any solution to suggest.
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.
Why doesn't IO
work? On 0.7 (unless something has changed very recently), typeof(stderr)
is TTY
, which is a subtype of IO
.
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.
I'm not sure we should care about supporting that deprecation after calling
redirect_stderr
This would mean that the deprecation wouldn't work in IJulia
, for example.
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.
Because of JuliaLang/julia#14919:
julia> (io::IO)() = 1
ERROR: cannot add methods to an abstract type
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.
I see… yes, I can't think of a way to make it work for IJulia (without adding an IJulia dependency), since IJulia redirects to its own IO
type.
Identifer confilict between meaning of IO and statical.
JuliaLang/julia#26636