Skip to content

Commit ae342ac

Browse files
authored
Merge pull request #22251 from JuliaLang/jb/operators
remove Operators module
2 parents 1a3391f + 2c3d947 commit ae342ac

13 files changed

+20
-84
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ Deprecated or removed
101101
which now require a module argument.
102102
And it caused the bugfix of other default arguments to use the Main module (including `whos`, `which`).
103103

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

105108
Julia v0.6.0 Release Notes
106109
==========================

base/dates/Dates.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ for more information.
3232
"""
3333
module Dates
3434

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

3838
using Base.Iterators

base/dates/periods.jl

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ Base.isless(x::P, y::P) where {P<:Period} = isless(value(x), value(y))
6565
Base.isless(x::Period, y::Period) = isless(promote(x, y)...)
6666

6767
# Period Arithmetic, grouped by dimensionality:
68-
import Base: div, fld, mod, rem, gcd, lcm, +, -, *, /, %
6968
for op in (:+, :-, :lcm, :gcd)
7069
@eval ($op)(x::P, y::P) where {P<:Period} = P(($op)(value(x), value(y)))
7170
end

base/deprecated.jl

+13
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,19 @@ function LibGit2.set_remote_url(path::AbstractString, url::AbstractString; remot
14211421
LibGit2.set_remote_url(path, remote, url)
14221422
end
14231423

1424+
module Operators
1425+
for op in [:!, :(!=), :(!==), :%, :&, :*, :+, :-, :/, ://, :<, :<:, :<<, :(<=),
1426+
:<|, :(==), :(===), :>, :>:, :(>=), :>>, :>>>, :\, :^, :colon,
1427+
:ctranspose, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat,
1428+
:xor, :|, :|>, :~, :×, :÷, :, :, :, :, :, :, :, :, :, :, :,
1429+
:, :, :, :, :, :]
1430+
if isdefined(Base, op)
1431+
@eval Base.@deprecate_binding $op Base.$op
1432+
end
1433+
end
1434+
end
1435+
export Operators
1436+
14241437
# END 0.7 deprecations
14251438

14261439
# BEGIN 1.0 deprecations

base/exports.jl

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export
44
# Modules
55
FFTW,
66
Meta,
7-
Operators,
87
Pkg,
98
LibGit2,
109
StackTraces,

base/grisu/float.jl

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31+
import Base: -, *
32+
3133
struct Float
3234
s::UInt64
3335
e::Int32

base/grisu/grisu.jl

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
module Grisu
44

5-
importall ..Base.Operators
6-
75
export print_shortest
86
export DIGITS, grisu
97

base/multidimensional.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module IteratorsMD
66
setindex!, IndexStyle, min, max, zero, one, isless, eachindex,
77
ndims, iteratorsize, convert
88

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

base/operators.jl

-71
Original file line numberDiff line numberDiff line change
@@ -902,74 +902,3 @@ julia> filter(!isalpha, str)
902902
```
903903
"""
904904
!(f::Function) = (x...)->!f(x...)
905-
906-
# some operators not defined yet
907-
global //, >:, <|, hcat, hvcat, , ×, , , , , , , , , , ,
908-
909-
this_module = @__MODULE__
910-
baremodule Operators
911-
912-
export
913-
!,
914-
!=,
915-
!==,
916-
===,
917-
xor,
918-
%,
919-
÷,
920-
&,
921-
*,
922-
+,
923-
-,
924-
/,
925-
//,
926-
<,
927-
<:,
928-
>:,
929-
<<,
930-
<=,
931-
==,
932-
>,
933-
>=,
934-
,
935-
,
936-
,
937-
>>,
938-
>>>,
939-
\,
940-
^,
941-
|,
942-
|>,
943-
<|,
944-
~,
945-
,
946-
×,
947-
,
948-
,
949-
,
950-
,
951-
,
952-
,
953-
,
954-
,
955-
,
956-
,
957-
,
958-
,
959-
,
960-
colon,
961-
hcat,
962-
vcat,
963-
hvcat,
964-
getindex,
965-
setindex!,
966-
transpose,
967-
ctranspose
968-
969-
import ..this_module: !, !=, xor, %, ÷, &, *, +, -,
970-
/, //, <, <:, <<, <=, ==, >, >=, >>, >>>,
971-
<|, |>, \, ^, |, ~, !==, ===, >:, colon, hcat, vcat, hvcat, getindex, setindex!,
972-
transpose, ctranspose,
973-
, , , , ×, , , , , , , , , , , , ,
974-
975-
end

base/pkg/resolve/fieldvalue.jl

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
module FieldValues
44

55
using ...VersionWeights
6-
importall .....Base.Operators
76

87
export FieldValue, Field, validmax, secondmax
98

base/pkg/resolve/versionweight.jl

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
module VersionWeights
44

5-
importall ....Base.Operators
6-
75
export VersionWeight
86

97
struct HierarchicalValue{T}

base/sysimg.jl

-1
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,5 @@ include(Base, "precompile.jl")
447447
end # baremodule Base
448448

449449
using Base
450-
importall Base.Operators
451450

452451
Base.isfile("userimg.jl") && Base.include(Main, "userimg.jl")

doc/src/manual/functions.md

-3
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ A few special expressions correspond to calls to functions with non-obvious name
169169
| `A[i]` | [`getindex()`](@ref) |
170170
| `A[i]=x` | [`setindex!()`](@ref) |
171171

172-
These functions are included in the `Base.Operators` module even though they do not have operator-like
173-
names.
174-
175172
## [Anonymous Functions](@id man-anonymous-functions)
176173

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

0 commit comments

Comments
 (0)