-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Proposal: Rename InStream
and OutStream
#4917
Comments
Doesn't
From the FIFO's perspectivethe FIFO is reading data into it with a "reader" and writing data out of it with a "writer" From Outside the FIFO's perspective:write data into a FIFO with a "writer" and read data out of it with a "reader" I don't see how |
Because it's about the usage pattern; you're entirely working outside the FIFO in most situations. |
I don't understand. If you're saying that you always look at it from outside the FIFO's perspective, then how is |
IMO it's less ambiguous because there's a long-term target location and a short-term buffer parameter. Read and write are always defined relative to this relationship - Readers read data into the temporary buffer from the target and Writers write data from the passed buffer into something more permanent. This terminology is not ambiguous, in the same way that the terms "read into a register" and "write out from a register" are not ambiguous. You could argue that readers are writing to the temporary, but nobody really cares about the reference point of the temporary because it's temporary. In/Out can theoretically be defined in the same way but IMO it's harder to intuit those properties from the name. |
I fully agree with @SpexGuy. |
After thinking on this more and reading your replies, I think I see why For example, is data coming Thanks for people's perspective. I agree that |
I definitely agree with this proposal! For example, when writing to an ArrayList, you write to an OutStream, which may confuses many people because when thinking of out, you think of data coming out, while in this case, data is going in. |
Start implementing ziglang#4917 which is to rename instream/outstream to reader/writer. This first change allows code to use Writer/writer instead of OutStream/outStream, but still maintains the old outstream names with "Deprecated" comments.
Start implementing #4917 which is to rename instream/outstream to reader/writer. This first change allows code to use Writer/writer instead of OutStream/outStream, but still maintains the old outstream names with "Deprecated" comments.
I believe this is now implemented thanks to @marler8997. There is already an issue to track removing deprecated API here: #3811 @marler8997 let me know if there are any tasks left and I'll re-open. |
The API should be usable by applications now (already using it here: marler8997/ziget@a47321b) All that's left is to remove the old API along with any components in the |
Spun off from #4908 (comment)
"In" and "out" are relative to a mental "reference point" in the programmer's head. In scenarios where the reference point is the application relative to some external thing,
InStream
andOutStream
seem intuitive (e.g. standard I/O, files, etc.). However, I think the names are not intuitive for situations where the reference point might be different, like a data structure. For example, when using theLinearFifo
(first in, first out) data structure, you write into the FIFO by usingoutStream
, and read out of the FIFO by usinginStream
. In this case, I think the names will be confusing for the majority of programmers and the opposite of what they expect.I propose renaming the streaming types to something like
Reader
andWriter
. It decouples the names from any reference point in the programmer's head and should be intuitive in a wider variety of scenarios. They'll do exactly what they say on the tin (similar to the existingAllocator
).The text was updated successfully, but these errors were encountered: