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

kioba

09/25/2017, 3:52 PM
As long as coroutines are experimental i would not recommend. But If youchose to go with coroutines without rx i would love to hear about the experience and you should definately write a blog about it 🙂
k

kioba

09/25/2017, 8:42 PM
I did not want to disscorouge you, i just shared my concerns 🙂 but anyway thanks for the link!
j

julienviet

09/26/2017, 9:53 AM
my opinion is that coroutines allows you to reason about asynchronous code in a synchronous manner, likewise JMM allows you to reason about java memory model
for some case it is interesting
for instance the classic database acquire/use/release connection
I find it much more natural using the try/catch/finally construct than with Rx
writing a non blocking parser also is an interesting case: if you have ever written a parser, you find it much more natural to reason about parser in a synchronous manner than in an non blocking manner
both are state machines
but with coroutines for me it’s easier to reason about it
here is an example of an HTTP parser
written with vertx and coroutines
you can compare it to the Netty HttpRequestDecoder
(which is much more complex and complete of course that’s an example)
3 Views