one of the things that I don’t get it, that Kotlin...
# coroutines
m
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.
r
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.
m
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
r
Because that's the least common denominator. You can still write in functional style just the same.
g
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
👍 2
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