Hi there,
The code is quite readable and clean. :-)
But I think you are overcomplicating things with the interfaces.
You're always passing things around with chan int64, so rather than
using interfaces with methods that return a chan int64, why not just
pass around the actual channels? You could even give the channel a
type for clarity, eg:
type SignalChan chan int64
I'm also curious as to why you have the Sinker create the channel. I
would have thought a Source would be more appropriate for this. But
better than either, it would be nice to create the channel independent
of the sources and sinks, that way you can attach any number of each
to either end.
Andrew
i'm not sure that works. if the Sink is creating the channel,
then that channel can be passed to multiple Sources
(i.e. multiple outputs can multiplex onto a single input),
but a Source can be connected to a single destination only.
i do think your current scheme works well, however: channels
manage fan-in automatically, but if multiple sources are
reading from the same channel, they each get a subset
of the values sent down the channel, which is rarely what
you want.