https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

dave08

11/01/2017, 10:02 PM
Is there some kind of
produce { }
for a
BroadcastChannel
?
e

elizarov

11/01/2017, 11:45 PM
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

dave08

11/02/2017, 3:13 AM
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?
2 Views