Hi, I am new to kotlin and just started using Coro...
# coroutines
r
Hi, I am new to kotlin and just started using Coroutines. I have few doubts. 1. If Coroutines is a language feature then why do we need to add dependencies? 2. How can I try latest 1.3 RC version in Android Studio? I tried following (and of course at its right place)
Copy code
// Downloaded 1.3. early preview plugin of Kotlin for Android Studio

ext.kotlin_version = '1.3.0-rc-46'
// ext.kotlin_version = '1.3.0-rc-57'
maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.1") {
        exclude group: "org.jetbrains.kotlinx", module: "atomicfu-common"
    }
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.1'
Above setup giving me error
No route to host (connect failed)
3. What is working for me is just
Copy code
ext.kotlin_version = '1.2.71'

implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.1") {
        exclude group: "org.jetbrains.kotlinx", module: "atomicfu-common"
    }
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.1'
Please guide me in the right direction. Thanks.
d
actually, the aim is for coroutines to mainly be implemented as a library, but some primitives are required (i.e. the suspend keyword) hence it's also part of the language
l
try kotlin version 1.3.0-rc-146 and coroutines 0.30.1-eap13 (eap13 build is specially version for 1.3 RC)
1 - kotlin core contains only basic couruotine support, that's mean you can write your own implementation
r
Thanks @Daniel Tam, @lex. It worked @lex
b
Yeah, suspension is a language feature, but all of the opinionated implementation details (ie, structured concurrency) are in the library. There shouldn't be anything preventing someone from writing their own coroutines library that utilizes the compiler
suspend
feature (minus reinventing the wheel)
👍 1