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

dave08

03/02/2018, 10:31 AM
Is there some practical use for the new
suspend
function in stdlib in 1.2.30? The release notes have an example that's not too clear to me what the point is...?
Copy code
suspend {     val result = deferredResult.await()     renderResult() }.startCoroutine(completion)
also check related issues
In general it’s just a way to create a lambda where you can call some other suspend functions but invoke only from other suspend context
d

dave08

03/02/2018, 10:40 AM
To compose suspend functions into a lambda that's not suspend? Why not just declare a suspend function and call them there? But then, I guess I'll take a look at those issues, thanks! Sometimes they're not so easy to find...
g

gildor

03/02/2018, 10:40 AM
because a function is not a lambda %)
Of course you can
Different semantics
4 Views