Is there some kind of `produce { }` for a `Broadca...
# coroutines
d
Is there some kind of
produce { }
for a
BroadcastChannel
?
e
Not yet. It is not hard to implement, though. The hardest part is how to name it 😉
The more composable solution, that I have in mind, is
broadcast()
extension, so that you can do
produce { ... }.broadcast()
. Solves the naming issue.
👍 1
d
Like
publish()
in rx, but then there would be the overhead of chaining the regular
Channel
in
produce { }
to a
BroadcastChannel
when
.broadcast()
is called. I was thinking of using this for broadcasting Android UI components to my business logic layer, which is lots of usage... Maybe the overhead is worth the semantics, but you could always use
broadcast { }
,
coBroadcast { }, coProduce{ }
or have a class be imported
import Coroutine.*
to namespace both like RxJava
Observable
class. Even if it would be a top level function, if there's a clash in naming, one couldn't do
import ...broadcast AS coBroadcast
. Or is that only for classes?