Skip to content

Commit 151b66c

Browse files
committed
Deprecate BitArray(shape...)-like constructors to BitArray(uninitialized, shape...) equivalents.
1 parent 9924e34 commit 151b66c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

NEWS.md

+8
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ Language changes
8282
For example, `f() = (global sin = "gluttony"; nothing)` will now resolve which module
8383
contains `sin` eagerly, rather than delaying that decision until `f` is run. ([#22984]).
8484

85+
* Uninitialized `BitArray` constructors of the form `BitArray[{N}](shape...)` have been
86+
deprecated in favor of equivalents accepting `uninitialized` (an alias for
87+
`Uninitialized()`) as their first argument, as in
88+
`BitArray[{N}](uninitialized, shape...)`. For example, `BitVector(3)` is now
89+
`BitVector(uninitialized, 3)`, `BitMatrix((2, 4))` is now
90+
`BitMatrix(uninitialized, (2, 4))`, and `BitArray{3}(11, 13, 17)` is now
91+
`BitArray{3}(uninitialized, 11, 14, 17)` ([#LIKETEARSINRAIN]).
92+
8593
* Dispatch rules have been simplified:
8694
method matching is now determined exclusively by subtyping;
8795
the rule that method type parameters must also be captured has been removed.

base/bitarray.jl

-5
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ mutable struct BitArray{N} <: DenseArray{Bool, N}
2929
return b
3030
end
3131
end
32-
# to deprecate in favor of the above uninitialized-accepting equivalent:
33-
BitArray{N}(dims::Vararg{Int,N}) where {N} = BitArray{N}(uninitialized, dims)
3432

3533
# note: the docs for the two signatures are unified, but only
3634
# the first one is recognized by the help system; it would be nice
@@ -58,9 +56,6 @@ julia> BitArray(uninitialized, (3, 1))
5856
"""
5957
BitArray(::Uninitialized, dims::Integer...) = BitArray(uninitialized, map(Int,dims))
6058
BitArray(::Uninitialized, dims::NTuple{N,Int}) where {N} = BitArray{N}(uninitialized, dims...)
61-
# to deprecate in favor of the above uninitialized-accepting equivalents:
62-
BitArray(dims::Integer...) = BitArray(uninitialized, dims)
63-
BitArray(dims::NTuple{N,Int}) where {N} = BitArray{N}(uninitialized, dims...)
6459

6560
const BitVector = BitArray{1}
6661
const BitMatrix = BitArray{2}

base/deprecated.jl

+5
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,11 @@ end
18741874
@deprecate diagm(v::AbstractVector, k::Integer) diagm(k => v)
18751875
@deprecate diagm(x::Number) fill(x, 1, 1)
18761876

1877+
# deprecate BitArray{...}(shape...) constructors to BitArray{...}(uninitialized, shape...) equivalents
1878+
@deprecate BitArray{N}(dims::Vararg{Int,N}) where {N} BitArray{N}(uninitialized, dims)
1879+
@deprecate BitArray(dims::NTuple{N,Int}) where {N} BitArray{N}(uninitialized, dims...)
1880+
@deprecate BitArray(dims::Integer...) BitArray(uninitialized, dims)
1881+
18771882
## deprecate full
18781883
export full
18791884
# full no-op fallback

0 commit comments

Comments
 (0)