-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up indexing and dispatch #571
Conversation
This should support non-scalar static indexing for any dimensionality (not just dimensions 1-4). By having fewer `getindex` and `setindex!` methods it should also substantially reduce the likelihood of ambiguities with other packages.
CC @mbauman, if he has time to consult about whether my corruption of |
Hmm, looks like we never tested Also, it looks like the 2nd commit got rid of a couple more ambiguities, so now we're down to 7. The third commit fortunately did not introduce new ambiguities. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A net negative number of lines and less ambiguities? What's not to like!
I say we go with it, though I can't comment on the evilness (or lack thereof) of what you've done with to_indices
:-)
I've rerun CI to check whether this interacts with #569. Looks like it's going to be fine across the board, so I'm inclined just to merge this and get the release out. |
TBH I fear the indexing tests are a bit on the thin side, so messing with the indexing rules is a bit scarier than I initially realized. Especially since there are close to 150 packages in JuliaRegistries/General that depend on this one. So, I locally merged this and #572. I'm running tests on all my installed packages that depend on StaticArrays (only 14 packages, though). I'll let you know how it goes. |
OK, I think this is fine. |
Great, I think I'll tag and release then. |
Ok, I see you've already done so, thanks! |
Several aspects of indexing were not ideal:
getindex(a::StaticArray, inds::Int...)
violates the AbstractArray interfaceAbstractArrays
only worked up to 4 dimensionsgetindex
andsetindex!
ambiguitiesThe first commit here fixes all of these problems while also reducing
detect_ambiguities(Base, StaticArrays)
from 35 pairs to 9. Serious progress on #18 🎆 .The second is boring but addresses JuliaLang/julia#6383 (comment). A
sed
script to fix this isif this ever creeps back in.