5 ms·
Right so you name the sender and receiver right? Then say a channel exists between them? Then send and receive are explicitly called on the sender and receiver
by GeorgeMac 12y ago
Right so you name the sender and receiver right? Then say a channel exists between them? Then send and receive are explicitly called on the sender and receiver respectively.
Which is the opposite of how Go names the channel and the `sender` is the routine which calls a send `x<-` on the named channel. The `receiver` in Go would be the main routine which calls receive on the named channel `<-x`.
I think that is the subtle difference.
- dragonwriter 12y ago> Right so you name the sender and receiver right? No, you create a channel with a sender and receiver handle, and then the tasks that are going to send or receive use those handles. You can think of send and receive handles as loosely analogous to send- or receive-only channels in Go (they are slighty different because only one task can use each handle, but they are cloneable to allow multiple tasks to use the channel, it just forces multiplexing on either end to be more of an explicit choice.)