Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate bitbroadcast #19771

Merged
merged 3 commits into from
Dec 31, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##

Expand Down Expand Up @@ -464,24 +463,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...)

Expand Down
20 changes: 20 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1224,4 +1224,24 @@ function quadgk(args...)
end
export quadgk

# Broadcast now returns a BitArray when the resulting eltype is Bool (#17623)
"""
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
```
"""
function bitbroadcast end
@deprecate bitbroadcast broadcast
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this also exported from Base? if so, delete it from exports.jl, the deprecate macro handles that

if not, could eval the deprecation into the Broadcast module so the qualified name doesn't change?


# End deprecations scheduled for 0.6
2 changes: 1 addition & 1 deletion doc/src/stdlib/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ All mathematical operations and functions are supported for arrays
```@docs
Base.broadcast
Base.Broadcast.broadcast!
Base.Broadcast.bitbroadcast
Base.bitbroadcast
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should usually delete docs for the old version when we deprecate something

```

## Indexing, Assignment, and Concatenation
Expand Down
4 changes: 2 additions & 2 deletions test/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,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
Expand Down