remove Operators module#22251
Merged
Merged
Conversation
Member
|
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
endThe annoying part will be that the message will appear for every use of the imported operator... |
Member
|
+1. I've thought that the selection of names in this module was rather random anyhow. |
648a73b to
2c3d947
Compare
Member
Author
|
Ok, should be ready to go. |
ararslan
approved these changes
Jun 13, 2017
tkelman
reviewed
Jun 14, 2017
| :ctranspose, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat, | ||
| :xor, :|, :|>, :~, :×, :÷, :∈, :∉, :∋, :∌, :∘, :√, :∛, :∩, :∪, :≠, :≤, | ||
| :≥, :⊆, :⊈, :⊊, :⊻, :⋅] | ||
| if isdefined(Base, op) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Operatorshad already switched to a different approach, eitherimport Base: +or definingBase.:(+)(...), such that theimportall Operatorsline could just be deleted.If this change is popular I can try to work out a deprecation mechanism.