https://kotlinlang.org logo
Title
k

karelpeeters

12/19/2017, 4:29 PM
Maybe
fun suspend(block: suspend () -> Unit) = block
works?
r

robin

12/19/2017, 4:30 PM
That's actually pretty nice, thanks! But I take it there is no in-language way to do this directly, then?
Ah, you have to add a
noinline
to the parameter though, otherwise the compiler complains.
...and then it's not really inlined, so it comes with a little overhead. Still a nice solution though 🙂
k

karelpeeters

12/19/2017, 4:33 PM
I'm not sure if there is a real solution, this is only my second day knowing about coroutines.
e

elizarov

12/19/2017, 5:20 PM
That is the solution we have for now. Whether there is going to be another solution in the future is an open question.