Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "intrinsic" implementation mean in Kotlin?

When browsing through Kotlin source code, I found that in some places NotImplementedError is thrown:

public suspend inline val coroutineContext: CoroutineContext
    get() {
        throw NotImplementedError("Implemented as intrinsic")
    }
public suspend inline fun <T> suspendCoroutineUninterceptedOrReturn(crossinline block: (Continuation<T>) -> Any?): T {
    contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
    throw NotImplementedError("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")
}

I assume these are not real not-implemented errors since otherwise code cannot run.

My questions are:

  • what does "intrinsic" mean here and why NotImplementedError is thrown?
  • where could I view the source code for these implementation?
like image 258
Wang Ke Avatar asked Nov 15 '25 17:11

Wang Ke


1 Answers

I've found this great answer for you, my dude.

like image 52
Alex Avatar answered Nov 17 '25 08:11

Alex