Skip to content

[6.0] changelog document SE-0428 and SE-424 #74005

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

Merged
merged 3 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,60 @@

## Swift 6.0

* [SE-0428][]:
Distributed actors now have the ability to support complete split server /
client systems, thanks to the new `@Resolvable` macro and runtime changes.

It is now possible to share an "API module" between a client and server
application, declare a resolvable distributed actor protocol with the expected
API contract and perform calls on it, without knowing the specific type the
server is implementing those actors as.

Declaring such protocol looks like this:

```swift
import Distributed

@Resolvable
protocol Greeter where ActorSystem: DistributedActorSystem<any Codable> {
distributed func greet(name: String) -> String
}
```

And the module structure to support such applications looks like this:

```
┌────────────────────────────────────────┐
│ API Module │
│========================================│
│ @Resolvable │
│ protocol Greeter: DistributedActor { │
┌───────┤ distributed func greet(name: String) ├───────┐
│ │ } │ │
│ └────────────────────────────────────────┘ │
│ │
▼ ▼
┌────────────────────────────────────────────────┐ ┌──────────────────────────────────────────────┐
│ Client Module │ │ Server Module │
│================================================│ │==============================================│
│ let g = try $Greeter.resolve(...) /*new*/ │ │ distributed actor EnglishGreeter: Greeter { │
│ try await greeter.hello(name: ...) │ │ distributed func greet(name: String) { │
└────────────────────────────────────────────────┘ │ "Greeting in english, for \(name)!" │
/* Client cannot know about EnglishGreeter type */ │ } │
│ } │
└──────────────────────────────────────────────┘
```

* [SE-0424][]:
Serial executor gain a new customization point `checkIsolation()`, which can be
implemented by custom executor implementations in order to provide a last resort
check before the isolation asserting APIs such as `Actor.assumeIsolated` or
`assertIsolated` fail and crash.

This specifically enables Dispatch to implement more sophisticated isolation
checking, and now even an actor which is "on a queue which is targeting
another specific queue" can be properly detected using these APIs.

* Closures can now appear in pack expansion expressions, which allows you to
construct a parameter pack of closures where each closure captures the
corresponding element of some other parameter pack. For example:
Expand Down Expand Up @@ -10464,6 +10518,9 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
[SE-0412]: https://github.com/apple/swift-evolution/blob/main/proposals/0412-strict-concurrency-for-global-variables.md
[SE-0413]: https://github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
[SE-0414]: https://github.com/apple/swift-evolution/blob/main/proposals/0414-region-based-isolation.md
[SE-0424]: https://github.com/apple/swift-evolution/blob/main/proposals/0424-custom-isolation-checking-for-serialexecutor.md
[SE-0428]: https://github.com/apple/swift-evolution/blob/main/proposals/0428-resolve-distributed-actor-protocols.md
[SE-0430]: https://github.com/apple/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md
[SE-0417]: https://github.com/apple/swift-evolution/blob/main/proposals/0417-task-executor-preference.md
[SE-0418]: https://github.com/apple/swift-evolution/blob/main/proposals/0418-inferring-sendable-for-methods.md
[SE-0420]: https://github.com/apple/swift-evolution/blob/main/proposals/0420-inheritance-of-actor-isolation.md
Expand Down