Patrick Ramsey

08/27/2021, 3:31 AM
was just poking around in kotlinx-coroutines. Saw
 * Returns the context of the current coroutine.
public suspend inline val coroutineContext: CoroutineContext
    get() {
        throw NotImplementedError("Implemented as intrinsic")
That is a wild bit of code. How does a
suspend inline val
exist in the language, and how is it that all it takes to make it work is to suppress the compiler warning that that’s not allowed?


08/27/2021, 6:30 AM
the definition here is just to make the name and type available to the frontend; the compiler backend recognizes the intrinsic name and replaces it with an implementation that cannot be expressed in pure Kotlin
👍 1
😮 1