Add SOneTo as AbstractUnitRange to represent axes(::StaticArray)
#534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has been on the to-do list for 2 years! 🎉
Now
axes(::StaticArray)will return a tuple of "static unit ranges / slices". TheSOneTotype lives underAbstractUnitRangeso it can work properly withBase, and is therefore not aStaticArraysubtype.One interesting side-effect is what happens to
collect:This matches the OffsetArrays package... basically if you want to mess with
axesyour behavior is automatically used bycollect, and in particular for offsets (Slices) you kind of need to rely on this to work out properly. I guess we should roll with this for now. If we can get generator/comprehension syntax working fast (constructingSVectors with optimal code) that could be pretty neat.I believe the benefits of this will eventually be far-reaching. In particular the
axesandkeysof an array can now be directly used as an indication of it's static-sizedness. This is more-or-less a trait that is already plumbed into many systems (likecollect). Hopefully this will make dealing with "wrapped up" types likeDiagonalwithSVectormore natural.Closes #476