The main contribution here is the file.Lines scope, which makes it easy to iterate over the lines of a file. I also did some cleanup of the core.for scope, which no longer requires exporting its state struct.
Known issues:
we don't appear to ever destroy the scope state object, so we never free the line buffer.
it would be nice to have a way to compose the file.With and file.Lines scopes, something like:
file.WithLines("foo.txt") each [line: []char] {
// operate on line
} error [e: errno.error] {
// handle file open/read errors
}
The main contribution here is the
file.Lines
scope, which makes it easy to iterate over the lines of a file. I also did some cleanup of thecore.for
scope, which no longer requires exporting its state struct.Known issues:
file.With
andfile.Lines
scopes, something like: