-
-
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
modify Base.peek to return a Char and export it #16025
Comments
we should make this match the read(io, UInt8)
read(io, Char)
peek(io, UInt8)
peek(io, Char) |
duplicate of #2638 [decision: no] |
The mark/reset API is good but it's very high overhead for just looking at a single character, which requires only a fixed amount of lookahead. The fact that we still use |
This could probably be closed just by renaming |
Or we could just do what @quinnj recommends and make |
Actually, even better: we can support generic |
The
peek
function is very useful and an efficient alternative to marking and resetting a stream when all you need to do is get a single character. The currentpeek
returns a byte, however, which leads to errors when people assume that they can compare that byte to a character and check for a character (only works for UTF-8 streams and ASCII characters). This was a significant annoyance in implementing #16024. This is technically not breaking sinceBase.peek
isn't exported. Most code that uses it will actually continue to work.The text was updated successfully, but these errors were encountered: