-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add support for @isolated(any) to withoutActuallyEscaping #76604
Description
Motivation
According to the diagnostic: withoutActuallyEscaping is currently unimplemented for @isolated(any) function values @isolated(any) was deliberately turned off for withoutActuallyEscaping. However, to fully migrate a function like this:
func send(
operation: @Sendable () async -> Void
) async {
await withoutActuallyEscaping(operation) { operation in
await withTaskGroup(of: Void.self) { taskGroup in
taskGroup.addTask {
await operation()
}
}
}
}... to mimic the signature of TaskGroup.addTask and to support all Swift 6 features of task creation APIs, we'd need support for this. If you want to, I can also provide a more realistic sample code where this would help.
Workaround is of course to use @escapable closures, and not using withoutActuallyEscaping. So this would be more of an ergonomic improvement.
Proposed solution
As already stated in the motivation, I'd propose to add support of @isolated(any) for withoutActuallyEscaping to get better ergonomics.
Alternatives considered
No response
Additional information
Forum thread: https://forums.swift.org/t/withoutactuallyescaping-and-isolated-any/74748