Fork me on GitHub

Why is there mult and can’t you tap on a channel directly?


mult manages the process of copying of messages from one input channel to ones that 'tap' onto the mult object. Moreover, user can tap/`untap` channels at any time. Having this functionality separate from a channel saves you a lot of headaches, e.g. what the channel should do it there are channels tapped and somebody else calls take! on that channel. By returning the mult object instead, you are restricting what the receiving party can do with it. Moreover, mult has a very specific requirements on channels that may not be suitable for all cases.