Skip to content

Add support for @isolated(any) to withoutActuallyEscaping #76604

Open
@ph1ps

Description

@ph1ps

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature request or implementationtriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions