-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Proposal: have Reader.readByte return !?u8 #5691
Copy link
Copy link
Closed
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Metadata
Metadata
Assignees
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
In my view, a "motto" of
io.Readeriszig/lib/std/io/reader.zig
Line 13 in 3aab601
However, the functions
readByte,readNoEof,readBytesNoEofand co. all returnerror.EndOfStreamwhen the end of the stream is reached. Wouldn't it make more sense to returnnullwhen the end of the stream is reached in order to differentiate end of stream from actual errors?This would also make some code nicer:
would be
I believe there is also precendent for the
!?...type inReader.readUntilDelimiterOrEoffor example.