3 ms·
Channels in Go lack priority support which made them unusable to express some patterns. Fortunately one can code a replacement for channels in Go using mutexes
by fpoling 5y ago
Channels in Go lack priority support which made them unusable to express some patterns.
Fortunately one can code a replacement for channels in Go using mutexes and semaphores. And that exercise in turn allows one to see that in many cases the channels are just a bad model. Things like having a single polymorphic priority message queue per go routine suits many cases better than dealing with multiple channels.
And this has been known since nineties if not eighties when Ada had to add mutexes after early designs based purely on channels. So it is puzzling why Go made channels such a central feature when the priority queue just works judging by Erlang or many successful C/C++ libraries.