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

louiscad

12/19/2017, 9:51 PM
Hi, is there a way to prohibit suspension in inline lambdas? In non inline, you have to explicitly allow it with the
suspend
keyword, but in inline, it's implicitly always allowed, by design it seems
d

dave08

12/20/2017, 3:26 AM
It's not really allowing or not - all the suspend keyword does (simply speaking) is add a callback param to your function that gets called when the continuation is resumed after suspention... inline doesn't need that since the code inside it is expanded in the calling site by the compiler, and of the calling site is suspendavle or in a coroutine, then it is 'allowed', if not, not. If that's what you meant?
e

elizarov

12/20/2017, 6:58 AM
Not yet. See https://youtrack.jetbrains.com/issue/KT-17260 You are welcome to add your own use-cases there
👍🏽 1
2 Views