Skip to content
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

Merged
merged 1 commit into from
Jun 15, 2017
Merged

remove Operators module #22251

merged 1 commit into from
Jun 15, 2017

Conversation

JeffBezanson
Copy link
Member

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, either import Base: + or defining Base.:(+)(...), such that the importall Operators line could just be deleted.

If this change is popular I can try to work out a deprecation mechanism.

@ararslan
Copy link
Member

ararslan commented Jun 6, 2017

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...

@vtjnash
Copy link
Member

vtjnash commented Jun 6, 2017

+1. I've thought that the selection of names in this module was rather random anyhow.

@tkelman tkelman added the deprecation This change introduces or involves a deprecation label Jun 6, 2017
@JeffBezanson JeffBezanson changed the title RFC: remove Operators module remove Operators module Jun 13, 2017
@JeffBezanson
Copy link
Member Author

Ok, should be ready to go.

:ctranspose, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat,
:xor, :|, :|>, :~, :×, :÷, :∈, :∉, :∋, :∌, :∘, :√, :∛, :∩, :∪, :≠, :≤,
:≥, :⊆, :⊈, :⊊, :⊻, :⋅]
if isdefined(Base, op)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which aren't?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants