Now that `main` can be suspended in 1.3, I propose...
# language-proposals
r
Now that
main
can be suspended in 1.3, I propose an all-suspend plugin that would make all functions
suspend
functions (along the same lines of the all-open plugin), allowing a Go style of programming without having to mark each function as suspended. (Note: I know next to nothing about Go, so I could be way off in my comparison. I'm also not sure of the implications of this idea, so I haven't even decided if I like it myself, but I figured I'd throw it out there.)
👍🏼 1
👎 4
l
Then, you lose atomicity when you need to update multiple things in a row. Go is different in this regard as you have to write go to go asynchronous. In Kotlin, you can't use a suspend function in a non suspending way to make it synchronous. So this will very likely be never implemented in Kotlin.
g
What is real use case of that?
j
This would be awesome, though I'm pretty sure it would destroy the interoperability with the JVM.
suspend
is (as far as I can tell) logically equivalent to blocking, it's just that one is more efficient than the other. In multi-threaded programs, there is no such thing as atomicity without locking anyways.