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

Provide extensions similar to Stdlib's readLines on Source #421

Open
fzhinkin opened this issue Dec 4, 2024 · 0 comments
Open

Provide extensions similar to Stdlib's readLines on Source #421

fzhinkin opened this issue Dec 4, 2024 · 0 comments

Comments

@fzhinkin
Copy link
Collaborator

fzhinkin commented Dec 4, 2024

Nice extensions to have would be functions like Path.forEachLine and Path.readLines.

Consuming all lines from a source now requires writing a boilerplate code and it would be nice to provide an extension doing all the heavy lifting.

Open questions are:

  • how to consume only N strings from a source using such an interface (or consume until a condition is met)?
  • should Source.lines() return a collection or a sequence? If it returns a sequence, who "owns" a source after a call and who's responsible for closing it?
  • does such an extension make sense for any source, or it is better suited for reading files and should be defined on a filesystem?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant