-
-
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
RFC: remove default importall Base.Operators
#12235
Conversation
At least it's a simple fix, but this is going to need to be updated in soo many packages. Definitely needs mentioning in NEWS.md, and a massive package PR spree for cleanup. |
PkgEvaluator @IainNZ? |
+1: Current situation is ostensibly arbitrary, smells magical, and generates conflicts. Package fix is trivial. |
Anyone who +1's this better help with making all of the necessary PR's. I could make test binaries off this branch pretty easily if the buildbots weren't screwed up and out of disk space right now. |
Also I'll say this so Iain doesn't have to. PackageEvaluator doesn't have to be run by him (it hasn't, in 11 days, since he's been at a conference and otherwise occupied). For quite some time it's been possible to run anywhere, by anyone who has Vagrant, disk space and cpu cycles. |
Indeed. Also, the machine it was running on had to be moved to my house, but I've had to turn it off because it was a giant space heater. Not sure how long until I can get it back up at another location. |
Oh wow I just realized what this PR is. Is there no way we can hack in some deprecation warning for operators being overload without this for this release and do it right after we start on 0.5? |
…`, but give warnings
2f6a8e4
to
1dde6e1
Compare
Ok, I have pulled out all the stops to make this non-breaking, but give warnings if you rely on the old behavior. It even found an import I missed in the first commit. |
Sounds great Jeff, I think its worth the effort! |
Much better. Still maybe worth mentioning in NEWS as a deprecation? |
RFC: remove default `importall Base.Operators`
https://groups.google.com/forum/#!topic/julia-users/o3mfc0vfsz8 I'm stunned by this change - so if I read it correctly in 0.5 Julia will allow accidental shadowing of basic operators? |
It'll allow it, but you'll get a warning (if I understand correctly) (plus possible hilarity if its a really important method):
|
@mdcfrancis The problem with the old behavior is that "operators" were special-cased --- they were imported by default in a way that nothing else is. But what counts as an operator? It's a messy position to be in. Some packages want to define their own version of Adding methods to functions in other modules has global effects: the method will be visible in many places. I don't see why that's the safer default. |
Here is what this might look like. It's not so bad, and I was pleasantly surprised to see that several submodules of Base already explicitly imported the operators they extend, which is a good sign. However life is very very hard without a default import of
Base.call
, so I think we're stuck with that for now. Still an improvement over importing the 73 identifiers in Base.Operators though.ref #8113