-
Notifications
You must be signed in to change notification settings - Fork 51
Breaking: error on unordered or reverse indices #847
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
base: breaking
Are you sure you want to change the base?
Conversation
|
@tiemvanderdeure I addedd global switch for this and made sure |
|
Agree that this one is pretty tricky right now and we need some better solution. It's a bit hard to see how often this problem would come up in practice. My initial thoughts are:
|
|
Yeah those all make sense. Probably any AbstractVector{Int} that isn't AbstractRange should convert a lookup to And yes probably most String categories are not intended to be ordered. Want to make issues for those separately? |
This is actually not the case, at least on breaking. Fixed already! |
Oops you're right. There's still some inconsistency in that when you index into a Regular lookups with a vector, it is turned into an Irregular lookup, while if you index into a Ordered lookup, it either remains Ordered or throws an error. I understand that with the I'll make an issue about the question when something should be ordered. |
|
The reason for the difference is switching to Irregular just changes the approach. But switching to The reason to check is to not lose So checking the order is preferable to switching to unordered. There is another approach... I considered adding a field to So I kind of think that sorted ascending is the 95% use case when using an |
I can't immediately see which use cases there would be for this. If you really know the order you can always use
This makes good sense! I don't know if we should consider a global switch that makes indexing behaves this way. But maybe there are just too few cases. (and we can always add functionality like that in a minor release) Another idea is to add something like But clearly you've thought more about this than I have and I can't think of a way to much improve this more fundamentally. |
|
The use case is to skip all of the checks. Like |
Okay I see - but 1) wouldn't you need to then still wrap that in |
Those are
Yeah, but Thats my point overall, this was a 20 second example |
closes #386