one of the things that I don’t get it, that Kotlin is full of features that help you write code in functional style, but they built Coroutines in a way that doesn’t change your “Imperative style” in code .. wasn’t be a good thing to build Coroutine so it fit nicely with a functional code.
07/27/2019, 12:31 PM
No, Kotlin is not a functional language. Coroutines need to work for any programming style. The way fontina features are implemented in Kotlin, along with support for suspendable lambdas, means you basically get "functional coroutines" for free when they're added to the core language.
07/27/2019, 12:47 PM
the whole premise of coroutine that it doesn’t change the way you code. you may build up on it .. but most of Coroutine examples did it the imperative way
07/27/2019, 12:59 PM
Because that's the least common denominator. You can still write in functional style just the same.
07/27/2019, 1:24 PM
Coroutines allow to write imperative and functional, it's just a language feature.
For example check #arrow, they use coroutines a lot for completely functional things
Suspend function by itself imo has nothing to do with imperative code, you can write functional code with it
But coroutines solve problem when non functional project have to use some functional concepts just to do asyncronous programming which very often do not add any value, just more confusion