Open
Description
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?