ursus
09/18/2025, 9:17 PMcoroutineScope { .. } length, or is it okay to have ot extend to the full function body?
Whats more idiomatic?jw
09/18/2025, 9:24 PMursus
09/18/2025, 9:28 PMjw
09/18/2025, 9:31 PMursus
09/18/2025, 9:35 PMkomu
09/19/2025, 5:29 AMcoroutineScope has the callsInPlace(block, InvocationKind.EXACTLY_ONCE) contract. So you can say:
val x: Int
val y: Int
coroutineScope {
x = 1
y = 2
}
println("x: $x, y: $y")
Sure, that's somewhat annoying, but still often cleaner than the alternatives.