https://kotlinlang.org logo
Title
x

xxfast

03/29/2023, 10:37 PM
Is there a proposal to allow `fun interface`s to be suspended?
y

Youssef Shoaib [MOD]

03/29/2023, 10:55 PM
It works? (Playground):
suspend fun main() {
    val kotlin = SuspendRunnable { "kotlin" }
    println(kotlin.run())
}
fun interface SuspendRunnable<R> {
    suspend fun run(): R
}
What version of kotlin are you using?
x

xxfast

03/29/2023, 10:59 PM
yea you are right - looks like this was added in a recent version
e

ephemient

03/29/2023, 11:06 PM
https://youtrack.jetbrains.com/issue/KT-44787 it was only broken in the old JVM backend, which was a while ago