From 987db4c979ae9a7d90ab577218ae357d32c7fab4 Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Sat, 25 Nov 2017 15:56:57 -0800 Subject: [PATCH] Deprecate BitArray(shape...)-like constructors to BitArray(uninitialized, shape...) equivalents. --- NEWS.md | 8 ++++++++ base/bitarray.jl | 5 ----- base/deprecated.jl | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1cee9e536ba0f6..fd09f8f7752cd0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -82,6 +82,14 @@ Language changes For example, `f() = (global sin = "gluttony"; nothing)` will now resolve which module contains `sin` eagerly, rather than delaying that decision until `f` is run. ([#22984]). + * Uninitialized `BitArray` constructors of the form `BitArray[{N}](shape...)` have been + deprecated in favor of equivalents accepting `uninitialized` (an alias for + `Uninitialized()`) as their first argument, as in + `BitArray[{N}](uninitialized, shape...)`. For example, `BitVector(3)` is now + `BitVector(uninitialized, 3)`, `BitMatrix((2, 4))` is now + `BitMatrix(uninitialized, (2, 4))`, and `BitArray{3}(11, 13, 17)` is now + `BitArray{3}(uninitialized, 11, 14, 17)` ([#24785]). + * Dispatch rules have been simplified: method matching is now determined exclusively by subtyping; the rule that method type parameters must also be captured has been removed. diff --git a/base/bitarray.jl b/base/bitarray.jl index fb9f8b11eee7fa..55a10c6cd21a93 100644 --- a/base/bitarray.jl +++ b/base/bitarray.jl @@ -29,8 +29,6 @@ mutable struct BitArray{N} <: DenseArray{Bool, N} return b end end -# to deprecate in favor of the above uninitialized-accepting equivalent: -BitArray{N}(dims::Vararg{Int,N}) where {N} = BitArray{N}(uninitialized, dims) # note: the docs for the two signatures are unified, but only # the first one is recognized by the help system; it would be nice @@ -58,9 +56,6 @@ julia> BitArray(uninitialized, (3, 1)) """ BitArray(::Uninitialized, dims::Integer...) = BitArray(uninitialized, map(Int,dims)) BitArray(::Uninitialized, dims::NTuple{N,Int}) where {N} = BitArray{N}(uninitialized, dims...) -# to deprecate in favor of the above uninitialized-accepting equivalents: -BitArray(dims::Integer...) = BitArray(uninitialized, dims) -BitArray(dims::NTuple{N,Int}) where {N} = BitArray{N}(uninitialized, dims...) const BitVector = BitArray{1} const BitMatrix = BitArray{2} diff --git a/base/deprecated.jl b/base/deprecated.jl index 18e9ee6d93d414..c494bbe9efc9bc 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1874,6 +1874,11 @@ end @deprecate diagm(v::AbstractVector, k::Integer) diagm(k => v) @deprecate diagm(x::Number) fill(x, 1, 1) +# deprecate BitArray{...}(shape...) constructors to BitArray{...}(uninitialized, shape...) equivalents +@deprecate BitArray{N}(dims::Vararg{Int,N}) where {N} BitArray{N}(uninitialized, dims) +@deprecate BitArray(dims::NTuple{N,Int}) where {N} BitArray{N}(uninitialized, dims...) +@deprecate BitArray(dims::Integer...) BitArray(uninitialized, dims) + ## deprecate full export full # full no-op fallback