-
-
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
Add readeach function for iterating streams #36150
Conversation
I think these are both basically good ideas, but I agree they should be 2 PRs. Unfortunately with the name |
Ah right. In my head |
This saves boilerplate versus a while !eof(io); read(io, T) loop. The function signature is patterned after the read(io, T) function signature. Prompted by JuliaLang#36132 but does not close JuliaLang#36132 I am open to better/clearer names for this function.
Remove usage of readline from skipchars definition.
These are all the places in base/stdlib where I saw the pattern used: while!eof(io); read(io, T) I think they make a good case study on this function's ability to make code dealing with IO cleaner.
aarch64 failure seems unrelated |
Can I suggest the name |
|
Would |
I think |
Triage says 👍 to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Although using skipchars reduced allocations, it overall slows down the function.
This is more succinct and focused than writing a file to disk and using open.
I've pushed two commits addressing @rfourquet's review that can be squashed once this is ready for merge. |
It looks like thre is a conflict in NEWS file. |
Co-authored-by: Matt Bauman <mbauman@juliacomputing.com>
See the commit messages and the discussion in #36132 for justification/explanation.
I can break this up into 2 PRs if there's only consensus on merging half of this, but it's semi-related, so I'm submitting as a single PR first.