-
-
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
remove Operators module #22251
remove Operators module #22251
Conversation
One possible deprecation strategy: module Operators
for op in [:!, :(!=), :(!==), :%, :&, :*, :+, :-, :/, ://, :<, :<:, :<<, :(<=),
:<|, :(==), :(===), :>, :>:, :(>=), :>>, :>>>, :\, :^, :colon,
:ctranspose, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat,
:xor, :|, :|>, :~, :×, :÷, :∈, :∉, :∋, :∌, :∘, :√, :∛, :∩, :∪, :≠, :≤,
:≥, :⊆, :⊈, :⊊, :⊻, :⋅]
@eval function $op(args...; kwargs...)
depwarn("The Operators module is deprecated. Use Base.$op instead.", $op)
Base.$op(args...; kwargs...)
end
end
end The annoying part will be that the message will appear for every use of the imported operator... |
+1. I've thought that the selection of names in this module was rather random anyhow. |
648a73b
to
2c3d947
Compare
Ok, should be ready to go. |
:ctranspose, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat, | ||
:xor, :|, :|>, :~, :×, :÷, :∈, :∉, :∋, :∌, :∘, :√, :∛, :∩, :∪, :≠, :≤, | ||
:≥, :⊆, :⊈, :⊊, :⊻, :⋅] | ||
if isdefined(Base, op) |
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.
which aren't?
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 have come to believe this module is at best useless. It's not a good practice to import a whole bunch of things at once and not be sure what you're getting, or what the code depends on. It's also not obvious what counts as an "operator"; at one time it may have been pretty clear but we have a lot more operators now, and have added some functions to the module that don't look like operators, so the classification is no longer useful.
Interestingly, while making this change I noticed that most of the Base modules that imported
Operators
had already switched to a different approach, eitherimport Base: +
or definingBase.:(+)(...)
, such that theimportall Operators
line could just be deleted.If this change is popular I can try to work out a deprecation mechanism.