3 ms·
Channels are also hardly foolproof. You need to internalize the (non-obvious) channel axioms[1], and there are many other pitfalls and annoyances like: - Needi
by unscaled 5y ago
Channels are also hardly foolproof. You need to internalize the (non-obvious) channel axioms[1], and there are many other pitfalls and annoyances like:
- Needing to determine ownership of closable objects passed across channels.
- Defining what special token (or OOB signaling mechanism) is used for marking end of data.
- Synchronizing who is closing the channel
Go channels are quite painful to use and often a simple lock would do better. This write-up[2] summarizes the issues with them quite nicely:
[1] https://dave.cheney.net/2014/03/19/channel-axioms https://dave.cheney.net/2014/03/19/channel-axioms
[2] https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad/ https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-s...