Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a method `lines_any` to `BufRead` #26743
Conversation
rust-highfive
assigned
huonw
Jul 2, 2015
This comment has been minimized.
This comment has been minimized.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
RalfJung
referenced this pull request
Jul 3, 2015
Closed
Unexpected behaviour with stdin and .lines() on Windows #26710
alexcrichton
reviewed
Jul 5, 2015
| /// The iterator returned from this function will yield instances of | ||
| /// `io::Result<String>`. Each string returned will *not* have the newline | ||
| /// separator at the end. | ||
| #[unstable(feature = "io", reason = "Just recently added.")] |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Jul 5, 2015
Member
We avoid blanket feature names nowadays, so can you rename this feature to lines_any?
alexcrichton
added
I-needs-decision
T-libs
labels
Jul 5, 2015
This comment has been minimized.
This comment has been minimized.
|
API and implementation-wise this looks fine to me, so tagging with T-libs and needs-decision. |
This comment has been minimized.
This comment has been minimized.
|
I renamed the feature as requested. Did you consider the proposal brought up by me here (and by others in #26710) to rather change the behavior of |
alexcrichton
reviewed
Jul 6, 2015
| /// An iterator over the lines of an instance of `BufRead` split on either `\n` or `\r\n`. | ||
| /// | ||
| /// See `BufRead::lines_any` for more information. | ||
| #[unstable(feature = "io", reason = "Just recently added.")] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I personally prefer this course of action as it mirrors what we do for strings already. |
This comment has been minimized.
This comment has been minimized.
|
oops sorry for that, I pushed another one. Please tell me if I should smash those commits together; for now I sticked to the guide which said that I should always only add new ones. Well, I'd argue that what we do for |
alexcrichton
added
final-comment-period
and removed
I-needs-decision
labels
Jul 8, 2015
This comment has been minimized.
This comment has been minimized.
|
Ok, we talked about this at the libs triage meeting today and the conclusion was to move this into its final comment period. Another possible idea that was floated was to deprecate |
This comment has been minimized.
This comment has been minimized.
|
Does this mean the RFC should be formulated within that one week of final comment period, or that you will decide in one week whether to merge this, or to ask someone to write an RFC? |
This comment has been minimized.
This comment has been minimized.
|
Ah this means that we're placing this specific RFC into the final comment period so we'll decide on this next week. If, however, a different strategy is preferred, then this will be closed in favor of an RFC. |
This comment has been minimized.
This comment has been minimized.
|
Okay.So I'll not (yet) try to figure out how to write an RFC ;-) I should also mention that some people already voiced their opinion in #26710. |
This comment has been minimized.
This comment has been minimized.
|
@RalfJung to be clear, if you'd prefer to change the behavior of the |
This comment has been minimized.
This comment has been minimized.
|
Yes, lines() need some 'improvement'
|
This comment has been minimized.
This comment has been minimized.
|
I would be strongly in favor of that breaking change in semantics to |
This comment has been minimized.
This comment has been minimized.
|
Sorry, then I misunderstood @alexcrichton . Okay, I will try to draft an RFC, and send the draft to @aturon to make sure I don't violate the process. I may not have the time to do that before the weekend, though. |
This comment has been minimized.
This comment has been minimized.
|
FYI: I drafted an RFC at https://github.com/RalfJung/rfcs/blob/line-endings/text/0000-line-endings.md. I'm currently waiting for some feedback before submitting it. |
This comment has been minimized.
This comment has been minimized.
|
@RalfJung Note that |
This comment has been minimized.
This comment has been minimized.
|
@bluss Good catch, you are right. I'll edit the document accordingly. Edit: Done. Thanks! |
This comment has been minimized.
This comment has been minimized.
|
I submitted this as RFC 1212: rust-lang/rfcs#1212. |
This comment has been minimized.
This comment has been minimized.
|
The consensus of the libs team this week was to close this PR in favor of the RFC (as this is listed as an alternative). We can always reopen if that's the decision of the RFC! |
RalfJung commentedJul 2, 2015
This mirrors the presence of
linesandlines_anyonString. This fixes rust-lang/rfcs#1188.Open questions:
linesto have the expected behavior of supporting both kinds of line endings properly. Unfortunately, withString, there already is a precedent oflinessupporting only\nandlines_anyadditionally supporting\r\n. Is there any chance of changing the existing behavior?Instead of writing a new iterator
LinesAny, I could also useLinesand amap. It is unclear to me whether that would be any shorter. Let me know if you'd rather have it the other way.