wait why is this?
# announcements
a
wait why is this?
g
Because sequence is syncronous only abstraction
Consumer can use it from non-suspend function
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
ah ok that makes sense
g
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