Fix Issue 17525 - std.algorithm.searching.skipOver should have a single argument with pred version#5543
Conversation
|
Thanks for your pull request, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
|
Any ideas on why circleci is failing? The line that is reported doesn't even call empty |
| auto s4 = "\t\t\t"; | ||
| assert(s2.skipOver!isWhite && s2 == "value"); | ||
| assert(!s3.skipOver!isWhite); | ||
| assert(s4.skipOver!isWhite && s3.empty); |
There was a problem hiding this comment.
You need to import empty from std.range.primitives here (public tests need to be runnable standalone)
|
@wilzbach Ah, didn't see that one. Thanks anyway. |
As this is now the second PR in a row, you should start a NG thread to remind people to tag their PRs. In theory the bot could do this as well (I don't recall why it doesn't, feel free to open an issue) |
|
@wilzbach should I keep this PR open or should I close it and review @JackStouffer 's ? |
As the other PR has a rather long discussion, I would first read through it and try to find out the consensus. IIRC there wasn't none yet. Once there is an agreement, you can always reopen this PR if necessary (or create a new one from the same branch). Sounds good? |
Btw do you see the |
…t with pred version
|
@wilzbach Oh I get it now. I didn't thought at all what that tiny x means. I rebased and added the proper name. Thanks for all the enlightening comments! |
|
@andralex it's there: https://github.com/dlang/phobos/pull/5543/files#diff-8b73351c2fbfb7fef513b00ced46d022R3989 , but I amended the commit so that there is no need to squash |
|
Err, I'm certain I must have pointed out somewhere (not this thread I guess) that this implementation is inconsistent with the other @andralex Does this make sense to you? |
|
@CyberShadow What do you mean by loop? https://github.com/dlang/phobos/pull/5543/files#diff-8b73351c2fbfb7fef513b00ced46d022R3947 : this seems like a loop to me |
|
That loop simply consumes the two input ranges for comparison; it does not consume multiple instances of the "prefix". Consider the difference between |
|
@CyberShadow As I see it, there are 2 classes of skipOver methods: those that skip over multiple range elements and those that skip over the first element. This PR enhances the first category. The 2 cases you are taking about are likely to appear in the real world and skipOver should manage them both. I don't see any inconsistency here. |
|
@CyberShadow it's a point, but the usefulness in parsing is there.
|
|
It would be less confusing if there was a different overload set for functions that skip over multiple instances of the pattern. |
|
The return types should be different. The version that skips multiple prefixes ought to return a |
|
@CyberShadow that's awfully nice, @RazvanN7 how about implementing that real quick? |
|
@andralex @RazvanN7 Found the previous discussion: #5497 (comment) Looks like we already have some primitives in Phobos to do some of these things. CC @wilzbach |
No description provided.