JuliaData / JuliaData/PooledArrays.jl
`pure=true` default to align with Base
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 49
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
I see why the pure keyword was added, but having pure=false contradicts Julia's behavior, which assumes mapped functions are pure. For instance:
julia> using SparseArrays
julia> A = sparse([1, 1, 2, 3], [1, 3, 2, 3], [3, 1, 2, 3])
3×3 SparseMatrixCSC{Int64, Int64} with 4 stored entries:
3 ⋅ 1
⋅ 2 ⋅
⋅ ⋅ 3
julia> map(x -> x^2 + rand(), A)
3×3 SparseMatrixCSC{Float64, Int64} with 9 stored entries:
9.54687 0.85208 1.86548
0.85208 4.31839 0.85208
0.85208 0.85208 9.26578
This default behavior is also inconsistent with most programmers' expectations, as map is a functional construct and therefore tends to assume side-effect free functions. This could lead to bugs; it also means that any code using map on a vector of unknown type can't take advantage of the performance enhancements provided by PooledArrays, since pure is not a keyword for the map method in base. As a result, I propose defaulting to pure=true.
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
The relevant entry point is PooledArrays' map method with the pure keyword; compare its default with Base Julia's map behavior. Reproduce the issue's SparseArrays example, then inspect the surrounding implementation and any existing map coverage. Done means the default is aligned with Base and the example behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100