From 1b86c36751a4bfbccb3af98548bd45e8a4ed1d68 Mon Sep 17 00:00:00 2001 From: Pablo Zubieta Date: Sat, 31 Dec 2016 10:27:50 -0600 Subject: [PATCH] Deprecate `bitbroadcast` (#19771) * Deprecate `bitbroadcast` * Remove `bitbroadcast` docs --- base/broadcast.jl | 21 +-------------------- base/deprecated.jl | 3 +++ base/exports.jl | 1 - doc/src/stdlib/arrays.md | 1 - test/bitarray.jl | 4 ++-- 5 files changed, 6 insertions(+), 24 deletions(-) diff --git a/base/broadcast.jl b/base/broadcast.jl index a4cec47b4dd6da..f401c4a4442b1a 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -7,8 +7,7 @@ using Base: promote_eltype_op, linearindices, tail, OneTo, to_shape, _msk_end, unsafe_bitgetindex, bitcache_chunks, bitcache_size, dumpbitcache, nullable_returntype, null_safe_eltype_op, hasvalue, is_nullable_array import Base: broadcast, broadcast! -export bitbroadcast, dotview -export broadcast_getindex, broadcast_setindex! +export broadcast_getindex, broadcast_setindex!, dotview ## Broadcasting utilities ## # fallbacks for some special cases @@ -453,24 +452,6 @@ julia> Ref(7) .+ Nullable(3) """ @inline broadcast(f, A, Bs...) = broadcast_c(f, containertype(A, Bs...), A, Bs...) -""" - bitbroadcast(f, As...) - -Like [`broadcast`](@ref), but allocates a `BitArray` to store the -result, rather then an `Array`. - -```jldoctest -julia> bitbroadcast(isodd,[1,2,3,4,5]) -5-element BitArray{1}: - true - false - true - false - true -``` -""" -@inline bitbroadcast(f, As...) = broadcast!(f, similar(BitArray, broadcast_indices(As...)), As...) - """ broadcast_getindex(A, inds...) diff --git a/base/deprecated.jl b/base/deprecated.jl index bd2deb760f2aea..003fdbc391e54c 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1346,6 +1346,9 @@ function quadgk(args...; kwargs...) end export quadgk +# Broadcast now returns a BitArray when the resulting eltype is Bool (#17623) +@deprecate bitbroadcast broadcast + # Deprecate two-argument map! (map!(f, A)) for a cycle in anticipation of semantic change @deprecate map!{F}(f::F, A::AbstractArray) map!(f, A, A) @deprecate asyncmap!(f, c; ntasks=0, batch_size=nothing) asyncmap!(f, c, c; ntasks=ntasks, batch_size=batch_size) diff --git a/base/exports.jl b/base/exports.jl index 7109b9d136b228..9ea3c205eefc9b 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -463,7 +463,6 @@ export zeta, # arrays - bitbroadcast, broadcast!, broadcast, broadcast_getindex, diff --git a/doc/src/stdlib/arrays.md b/doc/src/stdlib/arrays.md index 7e699a3f5f1199..25f7c79bd5c352 100644 --- a/doc/src/stdlib/arrays.md +++ b/doc/src/stdlib/arrays.md @@ -48,7 +48,6 @@ All mathematical operations and functions are supported for arrays ```@docs Base.broadcast Base.Broadcast.broadcast! -Base.Broadcast.bitbroadcast ``` ## Indexing, Assignment, and Concatenation diff --git a/test/bitarray.jl b/test/bitarray.jl index 9b4649e3f11116..eddc1250001b64 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -1136,8 +1136,8 @@ let b1 = trues(v1), b2 = falses(v1) end end -let odds = bitbroadcast(isodd, 1:2000) - evens = bitbroadcast(iseven, 1:2000) +let odds = broadcast(isodd, 1:2000) + evens = broadcast(iseven, 1:2000) for i = 1:2:2000 @test findprev(odds,i) == findprevnot(evens,i) == i @test findnext(odds,i) == findnextnot(evens,i) == i