Skip to content

Commit 3bb7e2f

Browse files
committed
remove default importall Base.Operators
fixes #8113
1 parent 721bdbe commit 3bb7e2f

19 files changed

+33
-16
lines changed

base/Dates.jl

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

33
module Dates
44

5+
importall ..Base.Operators
6+
57
include("dates/types.jl")
68
include("dates/periods.jl")
79
include("dates/accessors.jl")

base/REPL.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import Base:
1717
Display,
1818
display,
1919
writemime,
20-
AnyDict
20+
AnyDict,
21+
==
2122

2223
import ..LineEdit:
2324
CompletionProvider,

base/broadcast.jl

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ using ..Cartesian
66
import Base.promote_eltype
77
import Base.@get!
88
import Base.num_bit_chunks, Base._msk_end, Base.unsafe_bitgetindex
9-
import Base.(.+), Base.(.-), Base.(.*), Base.(./), Base.(.\), Base.(.//)
10-
import Base.(.==), Base.(.<), Base.(.!=), Base.(.<=)
9+
import Base: .+, .-, .*, ./, .\, .//, .==, .<, .!=, .<=, .%, .<<, .>>, .^
1110
export broadcast, broadcast!, broadcast_function, broadcast!_function, bitbroadcast
1211
export broadcast_getindex, broadcast_setindex!
1312

base/grisu.jl

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

33
module Grisu
44

5+
importall ..Base.Operators
6+
57
export print_shortest
68
export DIGITS, grisu
79

base/grisu/bignums.jl

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

3131
module Bignums
3232

33+
import Base: ==, <
34+
3335
export Bignum
3436

3537
const kMaxSignificantBits = 3584

base/linalg.jl

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

55
importall Base
6+
importall ..Base.Operators
67
import Base: USE_BLAS64, size, copy, copy_transpose!, power_by_squaring,
78
print_matrix, transpose!, unsafe_getindex, unsafe_setindex!
89

base/markdown/Markdown.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Markdown
44

5-
import Base: writemime
5+
import Base: writemime, ==
66

77
typealias String AbstractString
88

base/multidimensional.jl

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
module IteratorsMD
55

66
import Base: eltype, length, start, done, next, last, getindex, setindex!, linearindexing, min, max, eachindex, ndims
7+
importall ..Base.Operators
78
import Base: simd_outer_range, simd_inner_length, simd_index, @generated
89
import Base: @nref, @ncall, @nif, @nexprs, LinearFast, LinearSlow, to_index
910

base/pkg/reqs.jl

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

33
module Reqs
44

5+
import Base: ==
6+
57
using ..Types
68

79
# representing lines of REQUIRE files

base/pkg/resolve/fieldvalue.jl

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

55
using ...VersionWeights
6+
importall .....Base.Operators
67

78
export FieldValue, Field, validmax, secondmax
89

base/pkg/resolve/versionweight.jl

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

33
module VersionWeights
44

5+
importall ....Base.Operators
6+
57
export VersionWeight
68

79
immutable HierarchicalValue{T}

base/pkg/types.jl

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

55
export VersionInterval, VersionSet, Requires, Available, Fixed, merge_requires!, satisfies
6-
import Base: show, isempty, in, intersect, hash, deepcopy_internal
6+
import Base: show, isempty, in, intersect, hash, deepcopy_internal, ==
77

88
immutable VersionInterval
99
lower::VersionNumber

base/sparse.jl

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using Base.Sort: Forward
77
using Base.LinAlg: AbstractTriangular
88

99
importall Base
10+
importall ..Base.Operators
1011
importall Base.LinAlg
1112
import Base.promote_eltype
1213
import Base.@get!

base/sparse/spqr.jl

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

33
module SPQR
44

5+
import Base: \
6+
57
# ordering options */
68
const ORDERING_FIXED = Int32(0)
79
const ORDERING_NATURAL = Int32(1)

doc/manual/modules.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,20 @@ contain ``using Base``, since this is needed in the vast majority of cases.
160160
Default top-level definitions and bare modules
161161
----------------------------------------------
162162

163-
In addition to ``using Base``, all operators are explicitly imported,
164-
since one typically wants to extend operators rather than creating entirely
165-
new definitions of them. A module also automatically contains a definition
166-
of the ``eval`` function, which evaluates expressions within the context of
167-
that module.
163+
In addition to ``using Base``, modules also perform ``import Base.call`` by
164+
default, to facilitate adding constructors to new types.
165+
A new module also automatically contains a definition of the ``eval`` function,
166+
which evaluates expressions within the context of that module.
168167

169-
If these ``Base`` definitions are not wanted, modules can be defined using the
168+
If these default definitions are not wanted, modules can be defined using the
170169
keyword ``baremodule`` instead (note: ``Core`` is still imported, as per above).
171170
In terms of ``baremodule``, a standard ``module`` looks like this::
172171

173172
baremodule Mod
174173

175174
using Base
176175

177-
importall Base.Operators
176+
import Base.call
178177

179178
eval(x) = Core.eval(Mod, x)
180179
eval(m,x) = Core.eval(m, x)

examples/modint.jl

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module ModInts
44
export ModInt
55

6+
import Base: +, -, *
7+
68
immutable ModInt{n} <: Integer
79
k::Int
810
ModInt(k) = new(mod(k,n))

src/toplevel.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ void jl_add_standard_imports(jl_module_t *m)
4040
assert(jl_base_module != NULL);
4141
// using Base
4242
jl_module_using(m, jl_base_module);
43-
// importall Base.Operators
44-
jl_module_t *opmod = (jl_module_t*)jl_get_global(jl_base_module, jl_symbol("Operators"));
45-
if (opmod != NULL)
46-
jl_module_importall(m, opmod);
43+
// import Base.call
44+
jl_module_import(m, jl_base_module, jl_symbol("call"));
4745
}
4846

4947
jl_module_t *jl_new_main_module(void)

test/core.jl

+1
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,7 @@ test5536(a::Union{Real, AbstractArray}) = "Non-splatting"
17261726
@test_throws LoadError include_string("#= #= #= =# =# =")
17271727

17281728
# issue #6142
1729+
import Base: +
17291730
type A6142 <: AbstractMatrix{Float64}; end
17301731
+{TJ}(x::A6142, y::UniformScaling{TJ}) = "UniformScaling method called"
17311732
+(x::A6142, y::AbstractArray) = "AbstractArray method called"

test/linalg/arnoldi.jl

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ end
104104
size(Phi::CPM)=(size(Phi.kraus,1)^2,size(Phi.kraus,3)^2)
105105
issym(Phi::CPM)=false
106106
ishermitian(Phi::CPM)=false
107+
import Base: *
107108
function *{T<:Base.LinAlg.BlasFloat}(Phi::CPM{T},rho::Vector{T})
108109
rho=reshape(rho,(size(Phi.kraus,3),size(Phi.kraus,3)))
109110
rho2=zeros(T,(size(Phi.kraus,1),size(Phi.kraus,1)))

0 commit comments

Comments
 (0)