-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Implements thisind function #24414
Implements thisind function #24414
Conversation
… or equal than the given index
@StefanKarpinski @nalimilan |
I wasn't entirely convinced that we need this function, but as it turns out I'm working on a PR where this is necessary. The generic definition of |
It's a bit late, but I wonder whether |
A better name could be possible. I've ended up having to modify the behavior here a bit: in order for this to fix the |
Coming from reading the 0.7 news, wouldn't it make sense to return nothing if no such index exists since for 0.7 a lot of the index finding functions do so? That would help people getting a consistent feeling for when we use the Union-type as "nullable" |
That would have been worth investigating a while ago but at this point I think it's too late. |
just out of curiosity about the reasons, is it too late even though there's no official non-alpha release of a pre 1.0 versioned language that contains this function? would you even consider it a breaking change if that was changed? Edit: Rereading my text I found it to sound a bit harsh, I don't mean it that mean! |
All of the |
hm in context of the iterators it makes much more sense to use 0 as sentinel since you still want valid (though maybe empty) ranges. To fix this one would have to make Range(a,b) to be empty if a or b is nothing which would add some problems i guess... |
thisind(str::AbstractString, i::Integer)
gets the largest valid string index at or beforei
.Returns
0
if there is no valid string index at or beforei
. Returnsendof(str)
ifi≥endof(str)
.This is a proposed implementation of last part of #23765.