JuliaArrays / JuliaArrays/StaticArrays.jl

make indexing with a UnitRange return StaticArrays?

Open
#885 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.