How do you use rx with coroutines? All libs are pr...
# rx
d
How do you use rx with coroutines? All libs are proof of concept for now,...?
b
Ok, i think theres a misunderstanding here
Sequences, coroutines and rx are three different things
A sequence is a lazy collection which provides an iterator to get values
You dont need coroutines for that if you are working with simple sequential generators
But if your generator is complicated you could use coroutines for leveraging that generation
and then use the sequence operators like in a simple one, like take(10) or filter or whatever
You can use just a Sequence for one thing, a coroutine for other and maybe both for another user case
Same with RxJava which is an implementation of the reactive streams
You can use RxJava by itself
One example of use of both, in a cli utility i have, is I have an observable chain which i await for completion inside a coroutine
Another totally different thing is what was dicussed earlier in the thread was the possibility of a rewrite of rxjava or the creation of another reactive streams implementations using coroutines as an underlying tech
Thats what only exists as a proof of concept, as @thomasnield said
d
Yeah but one of the great things about rx is that you can await for results of different parts of the chain and combine the results, which is sequences on steriods... if coroutines are so cheap, why not implement sequences like that from the beginning...?
Its not just awaiting for the result of the whole operation...
Is there such a thing as a production ready rx scheduler to do such at thing?
b
You dont always use sequences to map them to async operations 🙂
Coroutines are experimental, but im sure more utilities will come to the stdlib along with the generators
For cases like that one
And although RxJava is not "coroutine based" id say its pretty production ready
d
I know rxjava is production ready, im currently using it alot, i was wondering if there is a
scheduleOn(RxKotlin.coroutine())
that could be used in production. Or maybe this is impossible?
b
No like that, you could create a coroutine and choose the context you want and then convert it to a flowable with the module i linked earlier
But as I said, coroutines are experimental, dont think thats what youd call production ready
Thats the section of contexts of the module guide
d
Oh! Thanks for the info, Ill look into it.. I thought that 1.1.4 already brought them out from experimental, they were already there from 1.0 i think.. are they putting them out of experimental state soon? I guess thats why everybodys still just at proof of concept discussions on this... 😧
b
The proof of concept is for building rx on top of coroutines not for coroutines per se
Regarding as when its out of experimental, i have no idea 🙂
"When its ready".toDateTime()
probably