hhvm / hsl-experimental

Experimental features for the Hack Standard Library
MIT License
23 stars 10 forks source link

Add `BufferedReader::linesIterator()` #153

Closed fredemmott closed 4 years ago

fredemmott commented 4 years ago

Also:

Iterating while ($reader->isEndOfFile()) has several edge cases:

readUntil still does exactly what it says on the tin.

The new behavior matches both C Rust IO. It's different from python, which addresses this by including the "\n".

Going for this approach instead of the python approach as I expect most users to just Str\strip_suffix()-away the trailing \n and not handle the empty string.

Providing a higher-level API seems to be safer.

facebook-github-bot commented 4 years ago

@fredemmott merged this pull request in hhvm/hsl-experimental@03ed30db1de1dbac8996b74cb8bfa4ec65ad528e.