I stumbled upon some interesting case about overloading:
actor class X {
func foo() {
// Do some work
}
// Async wrapper
func foo() async {
foo() // Error: call is not marked with 'await'
}
}
You cannot wrap sync foo inside an async function of the same name (to allow access from outside of actor, mentioned in another thread) because the compiler (current toolchain) is thinking that I intend to use the async function, which would cause infinite-loop. Maybe we can make sure that it doesn't do that but that's a very sharp edge.
What's the semantic for await-ing on actor-isolated async method?
@MainActor
func foo() async {
let a = await task1()
let b = await task2()
}
Does it need to jump back to MainActor between a and b? What happens if both task1 and task2 are actor-isolated?