-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Support using Statistics as Stat
#52784
Comments
It seems that it should be equivalent to this, but there is a warning that seems unintended with attempting it: julia> using Statistics: Statistics as Stat
julia> global Statistics
julia> using .Stat
WARNING: using Statistics.Statistics in module Main conflicts with an existing identifier. |
@vtjnash, am I correct in thinking that the Line 636 in 5643c60
|
Apparently the history of this warning is #4715, so this might specifically need to avoid the warning there when using the |
Declaring a global is also an observable property and I don't think it makes sense to declare a global named
|
Just to clarify, what's the current behavior of |
It's not valid syntax:
|
The Julia object model does have the notion of "using all the exported symbols except for one". As I see it we have a few options if we want to implement this
I'm currently investigating option 1. Open to alternative suggestions. |
Seems like a pretty niche usecase where you happily accept all |
The point is not so much to exclude loading the module name itself, but to support the syntax at all. I think this syntax is more intuitive and readable: using LongPackageName as LPN
using LongPackageName; const LongPackageName = LPN I do not think that the ability to rename packages on using will confuse new users because this renaming syntax is already supported in all other locations in using/import. The use case of wanting to load a long package under a short alias is reasonable in my opinion and may help allow folks to use descriptive package names without loosing brevity in domain specific usage. If we are agreed that we want the This can be implemented in a technically non-breaking way (though I think the current PR is already practically non-breaking), the tradeoff there is that to make it technically non-breaking requires a more complex mental model and/or a more complex object model. |
I disagree; |
FWIW, when The same arguments as for |
I propose that
using Statistics as Stat
loads all exported names in Statistics but does not load the name Statistics itself, instead loading the module as the nameStat
.This almost is equivalent to
And is equivalent to
The text was updated successfully, but these errors were encountered: