https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

Dico

09/19/2018, 2:42 AM
coroutineContext
is a top level property that can be accessed from suspend functions. I suspect that it does this under the hood:
Copy code
get() = suspendCoroutineUninterceptedOrReturn { cont -> cont.context }
g

gildor

09/19/2018, 3:22 AM
coroutineContext is intrinsic and do not do this under the hood, as I know, but replaced by actual context access without creation of additional suspend point
d

Dico

09/19/2018, 5:07 AM
Well,
suspend val
is not supported, the error is suppressed and it's implemented intrinsically, yes. I'm just pointing out that that's another way to get the context. Something interesting to think about imo. In reality, it can just access
Continuation
in the code directly, I think.
6 Views