JuliaArrays / JuliaArrays/StaticArrays.jl
make indexing with a UnitRange return StaticArrays?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
I think it would be useful for indexing with UnitRanges to produce StaticArrays instead of dynamically sized arrays. The current behavior means that something like a[2:end] can't be written in an efficient and generic way without having to add StaticArrays as an explicit dependency. I suspect that in almost all cases, constant propagation is smart enough to infer the size of the resulting array at compile time, so if used appropriately, this shouldn't actually introduce any type instabilities. This behavior would also be consistent with how Base handles indexing for tuples (although the implementation was not always well optimized until recently). I am not sure this would qualify as a minor change though, so unsure if this can be changed in 1.x.
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
No files, tests, or entry points are identified. Begin by locating the existing UnitRange indexing implementation and its tests, then determine whether returning StaticArrays is compatible with the 1.x API; done would require an agreed design and coverage for the changed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100