Closed lukehoersten closed 8 years ago
Yeah I see your point. I've never liked the InChan/OutChan
naming. But I don't think the names from io-streams really match the semantics here either. What we really want is
newChan :: IO (Ingress a, Egress a)
A "Chan" sort of exists in the ether, and we have access to its ends. "Front" and "Back" is also common in literature on queues so that could be a possibility. I hope you don't mind if I possibly make this the more general issue of naming the "chan ends" better, and edit the title.
Ingress and egress are still ambiguous. Ingress could mean "coming into my code out of the channel" or "going into the channel out of my code". It depends on the perspective. My thinking is that stdin/out established a convention (the perspective of the code/coder) and that's really the best we have to now with: convention.
But yeah, feel free to change the title of the issue.
Ah, I see what you mean now. Huh, that doesn't fit my own mental model of what we're doing at all. Will have to stew on this, thanks!
A bit of Googling and I could only find prominent examples of inStream
meaning "read-from from my perspective" and outStream
meaning "write-to from my perspective":
Personally Java would not convince me but it seems to be a convention going back to the 60s that spans OSs, languages and libraries.
Do you have some other basis for your mental model?
Well, my mental model is "channel". Like a hose: you can create a new hose, and you pass around both ends. The end with the nozzle is clearly the "egress".
Your suggestion is confusing to me because "STDIN" is the name of a channel (not an end). "STDOUT" is a completely different channel. Their names come from their very peculiar function of moving data into and out of a program, and the fact that our code writes to one and reads from the other follows from that. It sounds like when you see "STDIN" you maybe think "going into my code" when I think the name means "the channel for program input".
That said I totally see what you mean now. I'm not trying to argue just unpack my own perspective and understand yours.
Further complicating things is the "stream" abstraction. To my mind a stream (in the context of Haskell, rather than e.g. the "standard io streams" we were just talking about) is something resembling a list, rather than just another word for queue or channel; there might be an associated thing you can write values to, but you don't write to a stream.
It sounds like at least not using "in" and "out" in the names might help others. On Sep 29, 2015 9:12 PM, "Luke Hoersten" notifications@github.com wrote:
A bit of Googling and I could only find prominent examples of inStream meaning "read-from from my perspective" and outStream meaning "write-to from my perspective":
https://en.wikipedia.org/wiki/Standard_streams (stdin/out)
https://hackage.haskell.org/package/io-streams-1.2.1.1/docs/System-IO-Streams.html
- http://www.cprogramming.com/tutorial/c++-iostreams.html
- http://web.mit.edu/javadev/doc/tutorial/java/io/overview.html
Personally Java would not convince me but it seems to be a convention going back to the 60s that spans OSs, languages and libraries.
Do you have some other basis for your mental model?
— Reply to this email directly or view it on GitHub https://github.com/jberryman/unagi-chan/issues/14#issuecomment-144240895 .
How about Read
and Write
?
You read from the read and write to the write? Sounds good to me.
On Fri, Oct 2, 2015 at 4:48 PM Reid Draper notifications@github.com wrote:
How about Read and Write?
— Reply to this email directly or view it on GitHub https://github.com/jberryman/unagi-chan/issues/14#issuecomment-145162636 .
Closing this as I don't have any other names I'm enthusiastic about, and it's late in the game to change. I think it's for the next queue implementer to learn from this thread and try to come up with a better name.
We read from
stdin
and write tostdout
. Similarly,io-streams
allows you to read fromInputStreams
and write toOutputStreams
. Unagi chans are the reverse of this. Was there a motivation to name unagi chan in and out differently? If not, would you consider flipping it?