JuliaArrays / JuliaArrays/StaticArrays.jl
Traits for static arrays and friends
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
One thing that was realized in the AbstractArray interface is that traits are a convenient and powerful way of expressing ways of interacting with different types of arrays, the prototypical exampling being LinearFast vs LinearSlow. I wanted to discuss some possible traits that would be useful for StaticArrays.jl while keeping in mind that with future language enhancements (e.g. the trait system experiments of Traitor.jl) might make them easier to use and interface into Base in the future.
- Dispatch on size. We could have some kind of
Dimensionstrait (@timholy suggestedSDimsto complementBase.Dims). Unlike FixedSizeArrays, the size isn't specified in the abstractStaticVector{T}, while the package is meant to use thesize()on types interface, it doesn't make it easy to allow, e.g., any 3-vector. Introducing a trait would at least allow an "official" way of doing that. Speculatively, this could be extended so thatSDims <: AbstractDimensionsandBase.Arrayetc have a dimensions trait with run-time size information (but compile-time rank). The dimensions trait could be combined with the "indices" trait being proposed/used in Base for non-1-based indexing. - Mutable vs. immutable. Or, more specifically, does
setindex!work? Most algorithms in Base are defined usingsimilarbut that doesn't work for immutables, and it is a pain to define alternatives here that things other thanStaticArraycan't use at all. - Perhaps stack-allocated vs heap-allocated? We would put extra effort in for stack-allocated things so that we never make new heap allocations. This is obviously related to Mutable vs Immutable and
similarvssimilar_type.
Any thoughts appreciated. Is it a good idea to be defining types here, in this package?
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
Start by reading the issue's discussion of AbstractArray, LinearFast versus LinearSlow, and the linked Traitor.jl experiments. Compare the proposed dimensions, mutability, and allocation traits with the package's current interfaces. Done requires a maintainer-approved trait design and an agreed implementation scope; this issue does not name files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100