diff --git a/base/array.jl b/base/array.jl index 9d0e73d2c9e8b0..140207d1acf163 100644 --- a/base/array.jl +++ b/base/array.jl @@ -25,6 +25,14 @@ typealias DenseVecOrMat{T} Union{DenseVector{T}, DenseMatrix{T}} import Core: arraysize, arrayset, arrayref +""" + Array{T}(dims) + +Construct an uninitialized dense array with element type `T`. `dims` may +be a tuple or a series of integer arguments. +""" +Array + vect() = Array{Any,1}(0) vect{T}(X::T...) = T[ X[i] for i=1:length(X) ] diff --git a/base/asyncmap.jl b/base/asyncmap.jl index 112f30663b1120..617927866d97db 100644 --- a/base/asyncmap.jl +++ b/base/asyncmap.jl @@ -246,7 +246,7 @@ end # Special handling for some types. function asyncmap(f, s::AbstractString; kwargs...) - s2=Array(Char, length(s)) + s2 = Array{Char,1}(length(s)) asyncmap!(f, s2, s; kwargs...) return convert(String, s2) end diff --git a/base/boot.jl b/base/boot.jl index 92d61c8a694943..400f24f21b0289 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -330,13 +330,6 @@ typealias NTuple{N,T} Tuple{Vararg{T,N}} (::Type{Array{T,1}}){T}() = Array{T,1}(0) (::Type{Array{T,2}}){T}() = Array{T,2}(0, 0) -# TODO: possibly turn these into deprecations -Array{T,N}(::Type{T}, d::NTuple{N,Int}) = Array{T,N}(d) -Array{T}(::Type{T}, d::Int...) = Array(T, d) -Array{T}(::Type{T}, m::Int) = Array{T,1}(m) -Array{T}(::Type{T}, m::Int,n::Int) = Array{T,2}(m,n) -Array{T}(::Type{T}, m::Int,n::Int,o::Int) = Array{T,3}(m,n,o) - # primitive Symbol constructors function Symbol(s::String) return ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int), diff --git a/base/deprecated.jl b/base/deprecated.jl index a93744db4b5bd2..1c9d3d50e2f61c 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1638,4 +1638,15 @@ iteratoreltype(::Type{Task}) = EltypeUnknown() isempty(::Task) = error("isempty not defined for Tasks") +# Deprecate Array(T, dims...) in favor of proper type constructors +@deprecate Array{T,N}(::Type{T}, d::NTuple{N,Int}) Array{T,N}(d) +@deprecate Array{T}(::Type{T}, d::Int...) Array{T,length(d)}(d...) +@deprecate Array{T}(::Type{T}, m::Int) Array{T,1}(m) +@deprecate Array{T}(::Type{T}, m::Int,n::Int) Array{T,2}(m,n) +@deprecate Array{T}(::Type{T}, m::Int,n::Int,o::Int) Array{T,3}(m,n,o) +@deprecate Array{T}(::Type{T}, d::Integer...) Array{T,length(d)}(convert(Tuple{Vararg{Int}}, d)) +@deprecate Array{T}(::Type{T}, m::Integer) Array{T,1}(Int(m)) +@deprecate Array{T}(::Type{T}, m::Integer,n::Integer) Array{T,2}(Int(m),Int(n)) +@deprecate Array{T}(::Type{T}, m::Integer,n::Integer,o::Integer) Array{T,3}(Int(m),Int(n),Int(o)) + # End deprecations scheduled for 0.6 diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index 944cbd2c1b33af..ca267338a732c8 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -1676,15 +1676,6 @@ by `show` generally includes Julia-specific formatting and type information. """ show(x) -""" - Array(dims) - -`Array{T}(dims)` constructs an uninitialized dense array with element type `T`. `dims` may -be a tuple or a series of integer arguments. The syntax `Array(T, dims)` is also available, -but deprecated. -""" -Array - """ issubtype(type1, type2) diff --git a/base/libc.jl b/base/libc.jl index c3c67b57e8b711..03abe0746a9a41 100644 --- a/base/libc.jl +++ b/base/libc.jl @@ -277,7 +277,7 @@ if is_windows() const FORMAT_MESSAGE_FROM_SYSTEM = UInt32(0x1000) const FORMAT_MESSAGE_IGNORE_INSERTS = UInt32(0x200) const FORMAT_MESSAGE_MAX_WIDTH_MASK = UInt32(0xFF) - lpMsgBuf = Array(Ptr{UInt16}) + lpMsgBuf = Array{Ptr{UInt16},0}() lpMsgBuf[1] = 0 len = ccall(:FormatMessageW,stdcall,UInt32,(Cint, Ptr{Void}, Cint, Cint, Ptr{Ptr{UInt16}}, Cint, Ptr{Void}), FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index 03361eba1efad3..932c45b6a68f44 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -1390,7 +1390,7 @@ speye_scaled(diag, m::Integer, n::Integer) = speye_scaled(typeof(diag), diag, m, function speye_scaled(T, diag, m::Integer, n::Integer) ((m < 0) || (n < 0)) && throw(ArgumentError("invalid array dimensions")) nnz = min(m,n) - colptr = Array(Int, 1+n) + colptr = Array{Int,1}(1+n) colptr[1:nnz+1] = 1:nnz+1 colptr[nnz+2:end] = nnz+1 SparseMatrixCSC(Int(m), Int(n), colptr, Vector{Int}(1:nnz), fill!(Vector{T}(nnz), diag)) diff --git a/base/sparse/sparsevector.jl b/base/sparse/sparsevector.jl index 2fda783c40b9c8..a2f13ecbb57396 100644 --- a/base/sparse/sparsevector.jl +++ b/base/sparse/sparsevector.jl @@ -563,7 +563,7 @@ end function find{Tv,Ti}(x::SparseVector{Tv,Ti}) numnz = nnz(x) - I = Array(Ti, numnz) + I = Array{Ti,1}(numnz) nzind = x.nzind nzval = x.nzval @@ -587,8 +587,8 @@ end function findnz{Tv,Ti}(x::SparseVector{Tv,Ti}) numnz = nnz(x) - I = Array(Ti, numnz) - V = Array(Tv, numnz) + I = Array{Ti,1}(numnz) + V = Array{Tv,1}(numnz) nzind = x.nzind nzval = x.nzval diff --git a/base/sysimg.jl b/base/sysimg.jl index 76c33c770fefc9..5695eb950671b3 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -99,12 +99,6 @@ include("subarray.jl") (::Type{Matrix{T}}){T}(m::Integer, n::Integer) = Matrix{T}(Int(m), Int(n)) (::Type{Matrix})(m::Integer, n::Integer) = Matrix{Any}(Int(m), Int(n)) -# TODO: possibly turn these into deprecations -Array{T}(::Type{T}, d::Integer...) = Array(T, convert(Tuple{Vararg{Int}}, d)) -Array{T}(::Type{T}, m::Integer) = Array{T,1}(Int(m)) -Array{T}(::Type{T}, m::Integer,n::Integer) = Array{T,2}(Int(m),Int(n)) -Array{T}(::Type{T}, m::Integer,n::Integer,o::Integer) = Array{T,3}(Int(m),Int(n),Int(o)) - # numeric operations include("hashing.jl") include("rounding.jl") diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 6a5b146e3755f3..b369ac53d2667f 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -2242,7 +2242,7 @@ ,.(map (lambda (v r) `(= ,v (call (top length) ,r))) lengths rv) (scope-block (block - (= ,result (call (core Array) ,atype ,@lengths)) + (= ,result (call (curly Array ,atype ,(length lengths)) ,@lengths)) (= ,ri 1) ,(construct-loops (reverse ranges) (reverse rv) is states (reverse lengths)) ,result))))) diff --git a/test/test.jl b/test/test.jl index 3efa731036ba23..79bb9b40d78e40 100644 --- a/test/test.jl +++ b/test/test.jl @@ -27,7 +27,7 @@ @test 1234 === @test_nowarn(1234) @test 5678 === @test_warn("WARNING: foo", begin warn("foo"); 5678; end) -a = Array(Float64, 2, 2, 2, 2, 2) +a = Array{Float64,5}(2, 2, 2, 2, 2) a[1,1,1,1,1] = 10 @test a[1,1,1,1,1] == 10 @test a[1,1,1,1,1] != 2