What's in a name? {Receive,Send}Channel
See original GitHub issuefun idiomHasher() : ReceiveChannel<String> //=>
"Color me a nitpicker"
"A rose by any other moniker..."
So we receive data from a ReceiveChannel
and send data to a SendChannel
. Simple? Not really.
Even after some experience with channels, I’m struggling with the names. The train of thought is along these lines:
-
“I want to read from the channel; what was the name of the readable interface? er… hm… receive… oh yeah,
ReceiveChannel
”. Same withSendChannel
. -
Or more commonly, “I have a
ReceiveChannel
. So, is that something I receive from, or does it receive from me?”. Less so forSendChannel
.
I guess the issue here is while Receive
and Send
are behaviors (and behaviors are decent way to name interfaces), they are not specific enough.
IMHO, names that less ambigious:
-
Readable{Sumethin'}
tells me I can read from it vs.Writable{Sumthin'}
. (NodeJS) -
Output{YourFavoriteCommunicationOrificeHere}
tells me I must read from it, and vice versa withInput{YFCOH}
(DirectShow filters; yes I am dated).
Regarding whether {Receive,Send}Channel
are channels, or something else: according to Merriam-Webster, a channel is –
a means of communication or expression: such as (1) : a path along which information (such as data or music) in the form of an electrical signal passes.
So it would seem that Channel<E>
is appropriately named. However {Receive,Send}Channel
are interfaces to Channel
where data can hop on or off the channel and as such, they are not channels. Nautical terms that define such a concept include pier
, dock
, jetty
, and port
among others.
IMHO, {Receive,Send}Channel
should be renamed to:
{Receive,Send}Port
- Or better still
{Output,Input}Port
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I reuse this thread for a personal observation: often permissions are
readable
,writable
and so on, but aSendChannel
is writable if it notisClosedForSend
, and aReceiveChannel
is accessible if it notisClosedForReceive
, so I often use this double negation in my code.My suggestion is use the positive version, like
isOpenForSend
orisOpenForReceive
, or something similar likecanSend
orcanReceive
.Closing this one. Will not fix.