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

abstractarray.jl docs confusion: “storagetype might be a type or a function.” #37226

Closed
ron-wolf opened this issue Aug 27, 2020 · 1 comment · Fixed by #37237
Closed

abstractarray.jl docs confusion: “storagetype might be a type or a function.” #37226

ron-wolf opened this issue Aug 27, 2020 · 1 comment · Fixed by #37237

Comments

@ron-wolf
Copy link
Contributor

In the documentation for similar(), the following is written:

julia/base/abstractarray.jl

Lines 711 to 715 in 1c9c241

similar(storagetype, axes)
Create an uninitialized mutable array analogous to that specified by
`storagetype`, but with `axes` specified by the last
argument. `storagetype` might be a type or a function.

What does it mean for storagetype to be a function? I have tried to find a method for similar() that accepts a function for its first argument, but to no avail:

julia> methods(similar, (Any, NTuple))
# 6 methods for generic function "similar":
[1] similar(a::Array{T,N} where N, dims::Tuple{Vararg{Int64,N}}) where {T, N} in Base at array.jl:381
[2] similar(B::BitArray, dims::Tuple{Vararg{Int64,N}} where N) in Base at bitarray.jl:370
[3] similar(S::SharedArrays.SharedArray, dims::Tuple{Vararg{Int64,N}} where N) in SharedArrays at /Users/Ron/Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/SharedArrays/src/SharedArrays.jl:564
[4] similar(a::AbstractArray{T,N} where N, dims::Tuple) where T in Base at abstractarray.jl:630
[5] similar(::Type{T}, dims::Tuple{Vararg{Int64,N}} where N) where T<:AbstractArray in Base at abstractarray.jl:675
[6] similar(::Type{T}, shape::Tuple{Union{Integer, Base.OneTo},Vararg{Union{Integer, Base.OneTo},N} where N}) where T<:AbstractArray in Base at abstractarray.jl:674

julia> methods(similar, (Any, Vararg{AbstractRange,N} where N))
# 11 methods for generic function "similar":
[] # methods with empty varargs elided
[4] similar(B::BitArray, dims::Int64...) in Base at bitarray.jl:369
[]
[8] similar(A::Test.GenericArray, s::Integer...) in Test at /Users/Ron/Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Test/src/Test.jl:1654
[]
[10] similar(a::AbstractArray{T,N} where N, dims::Union{Integer, AbstractUnitRange}...) where T in Base at abstractarray.jl:631
[11] similar(::Type{T}, dims::Union{Integer, AbstractUnitRange}...) where T<:AbstractArray in Base at abstractarray.jl:673
@fredrikekre
Copy link
Member

It was removed in #26733 but looks like documentation was never updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants