Skip to content

Swift 6 preparations #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

jcubit
Copy link
Contributor

@jcubit jcubit commented May 4, 2025

This PR adds actor isolation to withEvaluatorManager as done by other APIs like AsyncHTTPClient. This is explained in detail in this talk, and is part of SE-0461 where it will be the default.

I noticed this when I tried to call this function from the library I am working on. As the above SE proposal says, it's easy to miss:

It's easy to write invalid async APIs. If the performAsync method were in a library that the programmer doesn't own, it's not possible to workaround the data-race safety error without using unsafe opt outs. It's common for library authors to mistakenly vend an API like this, because the data-race safety error only manifests when calling the API from an actor.

The PR also includes a change in the swift codegen types so that they are marked Sendable, and PklSwift is imported with @preconcurrency.

In addition, marked some basic types Sendable:

  • Duration
  • DurationUnit
  • ModuleSource
  • PklEvaluatorSettings
  • PklEvaluatorSettingsColor
  • Http
  • Proxy
  • ExternalReader, and
  • PathElement

@jcubit jcubit force-pushed the swift-6-preparations branch from 16accd3 to b9798b4 Compare May 7, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant