6 ms·
You can absolutely do this. `fun main() = runBlocking<Unit> {` https://kotlinlang.org/docs/composing-suspending-functions.html#async-style-functions https://k
by ackfoobar 4y ago
You can absolutely do this.
`fun main() = runBlocking<Unit> {`
https://kotlinlang.org/docs/composing-suspending-functions.html#async-style-functions https://kotlinlang.org/docs/composing-suspending-functions.h...
- SemanticStrengh 4y agoThen you'll have to explain why that isn't the default main behavior then. Synchronous functions cannot call async functions (without defining N runblocking scopes) but a runblocking main would make kotlin seems color-less and should be seen as best practice. What's the catch?
- ackfoobar 4y ago> would make kotlin seems color-less Quoting the post: > Having to mark asynchronous functions with suspend modifier is a small price to pay, but in return you get better insight into your code. Also you can do `suspend fun main()`