JuliaArrays / JuliaArrays/ArrayInterface.jl
ismutable wrong for FillArrays
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 140
- Forks
- 44
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 5
Description
FillArrays are not mutable.
julia> ArrayInterface.ismutable(typeof(Fill(4, (2,2))))
true
Should be
function ismutable(::Type{T}) where {T<:AbstractArray}
if parent_type(T) <: T
return false # no parent, and have not hit a type we know about
else
return ismutable(parent_type(T))
end
end
ismutable{::Type{<:Array}} = true
ismutable{::Type{<:SparseVector}} = true
ismutable{::Type{<:SparseMatrixCSC}} = true
ismutable{::Type{<:BitArray}} = true
Alternatively
the fallback case could be: return T.mutable rather than false.
On the assumption that if you are a mutable struct that has subtypes AbstractArray you probably have defined setindex
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/ArrayInterface.jl lines 75-81 and reproduce the FillArrays example showing ArrayInterface.ismutable(typeof(Fill(4, (2,2)))) returning true. Compare the proposed parent-type recursion and T.mutable fallback, then verify that FillArrays are classified as immutable while the listed mutable array types remain true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100