-
Notifications
You must be signed in to change notification settings - Fork 1
Rigorous index handling: boundschecks and indexstyle #52
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
==========================================
+ Coverage 75.42% 75.65% +0.23%
==========================================
Files 7 8 +1
Lines 476 571 +95
==========================================
+ Hits 359 432 +73
- Misses 117 139 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I'm not entirely sure how to fix the documentation and literate workflows concerning the compat entries. |
I think you just need to bump the SparseArraysBase.jl version in |
What if you try not marking it as a breaking change and see if the downstream tests pass? If they pass, I'd feel comfortable not marking it as breaking. Ideally packages wouldn't rely on the types of the iterators, just the values they iterate over. |
This reverts commit bb06cd4.
…ArrayInterface` is selected
I think this is now completely backwards compatible, although there are some small quirks to make this work. I'd say that the main thing which isn't super elegant is the interplay between having I somewhat worked around this, which on the surface looks like code duplication but I think most of it is required to make the dispatching work correctly. Otherwise this should be ready for review. |
I think it looks reasonable, maybe there is a way to simplify it but I can't see it right now... If we allowed for some breaking changes, what would you be able to simplify? |
Could you explain this point a bit more? Can't you always check for the IndexStyle? |
The situation I'm referring to is this: Imagine I want to define a fallback If I want to define a fallback for |
I think mostly the functions that take I'd have to think a bit more if there are more simplifications. |
Got it, thanks for the in-depth explanations. I think all of that makes sense. I think it is a bit tough to make these decisions in a vacuum, the current design seems good up to constraints on not being breaking and moves us in a good direction by supporting linear or cartesian indexing and bounds checking, and maybe as we use it more in other packages we can circle back on some of the designs. Would some of this become simpler if we changed the interface for overloading |
This was indeed what I was considering, but it's hard to gauge if everything works out without just trying it out somehow, so I am just not sure. I'm definitely okay with keeping this as-is, and re-evaluating as we go along. |
This PR implements indexing in a style more similar to how
Base
handles this, with canonicalIndexStyle
options and a more fixed callchain of converting different index types into eachother.Additionally, this (re)introduces boundschecking on sparse arrays.
I've updated the version as if this is a breaking change, but the breaking changes are quite minor: the output type of some of the iterators has changed a bit.
In principle I think we might be able to say this is not breaking, but I wanted to be slightly cautious about this.