JuliaArrays / JuliaArrays/StaticArrays.jl

indexing with static vector

Open
#344 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cleanup
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

I just tried to create a custom type inheriting from SVector and create a custom indexing behavior (getindex(A::AbstractArray, p::MyPoint)).
In theory, one just needs to overload:

Base.to_indices(A::AbstractArray, p::Tuple{<: Point}) = round.(Int, p[1].x)

To make this work, but because StaticArrays overloads getindex(A::AbstractArray, x::SVector) this doesn't work anymore.
Is this just wrongly overloading the getindex interface, or was there a reason to overload getindex directly?

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

Start by examining StaticArrays' getindex overload for AbstractArray and SVector, then compare it with Julia's Base.to_indices interface described in the issue. Determine whether custom Point indexing can coexist with the overload; done means the intended indexing behavior is clarified and covered by a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.