...the declaration decides where it wants to run...
That is until this proposal gets through correct? Then it's only if the declaration explicitly declares it should run concurrently or with a different specific isolation (i.e. is an actor or part of a global actor different from the current isolation).
I wanted to ask you specifically because you're involved in that thread but it didn't seem like a place to interject, but if that proposal goes through and the caller then specifies the isolation by default, does that mean that any async function that doesn't specify a different isolation will effectively run like a synchronous function (without suspending?).
struct SomeWork {
func execute() async throws {
print(1+1)
// If this awaited execution on the main actor this would be the *first*
// and only suspension point other than the initial call into the actor.
}
}
struct SomeOtherWork {
func execute() async throws -> Foo {
// Would this then forward the same isolation?
try await SomeWork().execute()
return Foo()
}
}
actor IAmTheIsolation {
func doTheThing() async throws -> Foo {
// Since this now inherits the same isolation does it even suspend?
try await SomeOtherWork().execute()
}
Is my assumption correct there? Does that technically make everything more performant as well since there's less suspending?