Skip to content
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

print! and friends should flush on '\r' as well as '\n' #56015

Closed
RandomInsano opened this issue Nov 17, 2018 · 2 comments
Closed

print! and friends should flush on '\r' as well as '\n' #56015

RandomInsano opened this issue Nov 17, 2018 · 2 comments
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@RandomInsano
Copy link
Contributor

RandomInsano commented Nov 17, 2018

I read some of #23818 and I'm unsure exactly what the standards are in C++, Java, Python and friends for this issue (if needed I can do research), but it seems unusual that output which includes a carriage return (ex: "Time to go: {} seconds\r") does not flush the output stream up to the point that the carriage return should be acted upon.

I'd expect this functionality to match what occurs when a new-line character is sent.

I'm runnin rustc 1.32.0-nightly (6b9b97bd9 2018-11-15) if that's relevant to discussion.

@Lucretiel
Copy link
Contributor

Lucretiel commented Dec 18, 2018

What other languages do:

  • Go: no built in line buffering
  • Python: Flush on Newline or Carriage Return
  • C++: By default, follows whatever your local stdio.h is doing. C++ does not itself provide any line buffering; all it can do is be sync'd or unsync'd with stdio.
  • C: (http://www.cplusplus.com/reference/cstdio/setvbuf/) Only looks at newline, not carriage return.

I couldn't find any documented behavior for Ruby or NodeJS.

With the caveat that this should be a change to LineWriter, as opposed to a change specific to the print macros, I'd be in favor of this (so long as it doesn't significantly impact performance).

@RandomInsano RandomInsano reopened this Dec 18, 2018
@estebank estebank added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 11, 2019
@Enselic
Copy link
Member

Enselic commented Nov 18, 2023

Triage: Thank you for the suggestion. This would have very big impact on the Rust ecosystem, and by my estimation needs to go through an RFC, so I'll go ahead and close this issue now. See https://github.com/rust-lang/rfcs/blob/master/libs_changes.md for more info on when an RFC is needed (which I would say is clearly needed in this case).

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants