There is no API in sequence to consume values asyncronously
So this is the reason, why only yield suspend function is allowed in sequence builder, to avoid confusion when one may accidentally block caller thread by invoking some arbitrary suspend function
a
Andrew Gazelka
06/02/2019, 2:19 AM
ah ok that makes sense
g
gildor
06/02/2019, 2:19 AM
If you need fully async streams, use kotlinx.coroutines Flow, which may be consumed only from suspend function
Sorry, suspend -> sequence in my first message
Suspend of course asyncronous, but sequence is syncronous, but lazy, same way as Java streams