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

louiscad

06/06/2019, 2:03 PM
Do you think passing a
CompletableDeferred
down a
Flow
or a
Channel
(exposed as a
ReceiveChannel
) is a good idea? The use case is to allow to observe a state (a sealed class instance), and allow an action depending on that state.
u

uhe

06/06/2019, 2:11 PM
Why not just send the state change as a regular value over the channel?
1
l

louiscad

06/06/2019, 2:28 PM
The state change already passes down the flow/channel. What I'm looking for is allowing an action just for that state (obsolete when the state changes).
s

streetsofboston

06/06/2019, 2:42 PM
Is this somewhat like what is used on RxAndroidBle where connecting to a device emits an Observable that represents the connection-setup and then observing that emitted Observable will yield a Connection?
z

Zach Klippenstein (he/him) [MOD]

06/06/2019, 3:20 PM
That's common in CSP systems I think. You send a message to a process, and that message contains a dedicated channel just for sending responses back.
2 Views