`kotlinx.coroutines` version `0.7-beta` is publish...
# coroutines
e
kotlinx.coroutines
version
0.7-beta
is published. It includes production-quality mostly lock-free implementation of Go-style channels that enable coroutines to safely share streams of arbitrary elements or messages without actually sharing any mutable state (e.g. share data by communicating). More details here: https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#channels
👍 11
d
Can’t fully believe we are going to have channels on Android soon 🙂
k
Does this look like Rx Observables to anyone else? ☺️
d
@kenkyee of course it does, but it’s potentially more powerful and simple. For instance, you can use language’s
for
,
if
and so on with it, but you can’t with rxjava (you need
filter
,
doOnEach
and so on)
e
It is conceptually very different from Rx. You can use it to do the same stuff that you do with Rx. However, you don’t have to learn dozens of Rx operators. With just a few primitives you can do control flow and logic of arbitrary complexity.
👍 1
d
will Kotlin have alts!/select operator?
e
yes
It will be called
select
. Something like:
Copy code
select {
    chan1.receive() { elem1 -> doSmth(elem1) }
    chan2.receive() { elem2 -> doSmth(elem2) }
}
👍 1
To clarify, this is nothing to do with Kotlin as a language. It will be part of
kotlinx.coroutines
library. Kotlin as a language is powerful enough, so that all those features can be written in a library.
👍 1