Skip to content

Commit

Permalink
Deprecate BitArray(shape...)-like constructors to BitArray(uninitiali…
Browse files Browse the repository at this point in the history
…zed, shape...) equivalents.
  • Loading branch information
Sacha0 committed Nov 26, 2017
1 parent 9924e34 commit 987db4c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 987db4c

Please sign in to comment.