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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ Deprecated or removed
which now require a module argument.
And it caused the bugfix of other default arguments to use the Main module (including `whos`, `which`).

* The `Operators` module is deprecated. Instead, import required operators explicitly
from `Base`, e.g. `import Base: +, -, *, /` ([#22251]).


Julia v0.6.0 Release Notes
==========================
Expand Down
2 changes: 1 addition & 1 deletion base/dates/Dates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for more information.
"""
module Dates

importall ..Base.Operators
import ..Base: ==, div, fld, mod, rem, gcd, lcm, +, -, *, /, %
import ..Base.broadcast

using Base.Iterators
Expand Down
1 change: 0 additions & 1 deletion base/dates/periods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Base.isless(x::P, y::P) where {P<:Period} = isless(value(x), value(y))
Base.isless(x::Period, y::Period) = isless(promote(x, y)...)

# Period Arithmetic, grouped by dimensionality:
import Base: div, fld, mod, rem, gcd, lcm, +, -, *, /, %
for op in (:+, :-, :lcm, :gcd)
@eval ($op)(x::P, y::P) where {P<:Period} = P(($op)(value(x), value(y)))
end
Expand Down
13 changes: 13 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,19 @@ function LibGit2.set_remote_url(path::AbstractString, url::AbstractString; remot
LibGit2.set_remote_url(path, remote, url)
end

module Operators
for op in [:!, :(!=), :(!==), :%, :&, :*, :+, :-, :/, ://, :<, :<:, :<<, :(<=),
:<|, :(==), :(===), :>, :>:, :(>=), :>>, :>>>, :\, :^, :colon,
: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.

<|

@eval Base.@deprecate_binding $op Base.$op
end
end
end
export Operators

# END 0.7 deprecations

# BEGIN 1.0 deprecations
Expand Down
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export
# Modules
FFTW,
Meta,
Operators,
Pkg,
LibGit2,
StackTraces,
Expand Down
2 changes: 2 additions & 0 deletions base/grisu/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import Base: -, *

struct Float
s::UInt64
e::Int32
Expand Down
2 changes: 0 additions & 2 deletions base/grisu/grisu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module Grisu

importall ..Base.Operators

export print_shortest
export DIGITS, grisu

Expand Down
2 changes: 1 addition & 1 deletion base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module IteratorsMD
setindex!, IndexStyle, min, max, zero, one, isless, eachindex,
ndims, iteratorsize, convert

importall ..Base.Operators
import Base: +, -, *
import Base: simd_outer_range, simd_inner_length, simd_index
using Base: IndexLinear, IndexCartesian, AbstractCartesianIndex, fill_to_length, tail

Expand Down
71 changes: 0 additions & 71 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -902,74 +902,3 @@ julia> filter(!isalpha, str)
```
"""
!(f::Function) = (x...)->!f(x...)

# some operators not defined yet
global //, >:, <|, hcat, hvcat, ⋅, ×, ∈, ∉, ∋, ∌, ⊆, ⊈, ⊊, ∩, ∪, √, ∛

this_module = @__MODULE__
baremodule Operators

export
!,
!=,
!==,
===,
xor,
%,
÷,
&,
*,
+,
-,
/,
//,
<,
<:,
>:,
<<,
<=,
==,
>,
>=,
≥,
≤,
≠,
>>,
>>>,
\,
^,
|,
|>,
<|,
~,
⋅,
×,
∈,
∉,
∋,
∌,
⊆,
⊈,
⊊,
∩,
∪,
√,
∛,
⊻,
∘,
colon,
hcat,
vcat,
hvcat,
getindex,
setindex!,
transpose,
ctranspose

import ..this_module: !, !=, xor, %, ÷, &, *, +, -,
/, //, <, <:, <<, <=, ==, >, >=, >>, >>>,
<|, |>, \, ^, |, ~, !==, ===, >:, colon, hcat, vcat, hvcat, getindex, setindex!,
transpose, ctranspose,
≥, ≤, ≠, ⋅, ×, ∈, ∉, ∋, ∌, ⊆, ⊈, ⊊, ∩, ∪, √, ∛, ⊻, ∘

end
1 change: 0 additions & 1 deletion base/pkg/resolve/fieldvalue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module FieldValues

using ...VersionWeights
importall .....Base.Operators

export FieldValue, Field, validmax, secondmax

Expand Down
2 changes: 0 additions & 2 deletions base/pkg/resolve/versionweight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module VersionWeights

importall ....Base.Operators

export VersionWeight

struct HierarchicalValue{T}
Expand Down
1 change: 0 additions & 1 deletion base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,5 @@ include(Base, "precompile.jl")
end # baremodule Base

using Base
importall Base.Operators

Base.isfile("userimg.jl") && Base.include(Main, "userimg.jl")
3 changes: 0 additions & 3 deletions doc/src/manual/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ A few special expressions correspond to calls to functions with non-obvious name
| `A[i]` | [`getindex()`](@ref) |
| `A[i]=x` | [`setindex!()`](@ref) |

These functions are included in the `Base.Operators` module even though they do not have operator-like
names.

## [Anonymous Functions](@id man-anonymous-functions)

Functions in Julia are [first-class objects](https://en.wikipedia.org/wiki/First-class_citizen):
Expand Down