are there any plans in the future to allow overloa...
# coroutines
j
are there any plans in the future to allow overloading methods based on whether they're suspending or not?
Copy code
fun blah() { ... }

suspend fun blah() { ... }
now if I'm in a coroutineContext and call blah, it calls the suspending one and if I'm not in a coroutineContext or in Java-land, it calls the non-suspending one
s
you can call your non-suspend version from suspend context.... if you can define a function as non-suspend you should do that, why would you mark it suspend if you don't need to?
g
It would cause ambiguous call resolution from suspend context
So I don't think that it's possible
Also semantically those functions are quite different (first is blocking or launches background work and do not allow to wait for it) Usually for java I would have something like: fun blahFuture(): CompletableFuture