JuliaArrays / JuliaArrays/OffsetArrays.jl
Constrain the types dispatched on in Base functions like fill, ones, zeros, trues, falses
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 212
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
Currently the function signature for fill is
However the function clearly only works with integral values, as the OffsetArray constructor only accepts Ints. Something like this will fail:
julia> fill(3.0,UnitRange(3.0,5.0))
ERROR: MethodError: no method matching OffsetArray(::Array{Float64,1}, ::Tuple{Float64})
Should the types dispatched upon be constrained to UnitRange{<:Integer}? This will also allow other packages to define these methods for various other UnitRange types.
The same for other functions like zeros, ones, trues, falses.
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/OffsetArrays.jl around lines 212-213, starting with the fill signature and then inspect the related zeros, ones, trues, and falses methods. Check how their UnitRange dispatch relates to OffsetArray construction; done means the listed Base functions have appropriately constrained dispatch and the behavior is covered by relevant tests, although no test file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100