Skip to content

Commit 81f0439

Browse files
committed
changelog document SE-0428
1 parent d812e11 commit 81f0439

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,50 @@
55
66
## Swift 6.0
77

8+
* [SE-0428][]:
9+
Distributed actors now have the ability to support complete split server /
10+
client systems, thanks to the new `@Resolvable` macro and runtime changes.
11+
12+
It is now possible to share an "API module" between a client and server
13+
application, declare a resolvable distributed actor protocol with the expected
14+
API contract and perform calls on it, without knowing the specific type the
15+
server is implementing those actors as.
16+
17+
Declaring such protocol looks like this:
18+
19+
```swift
20+
import Distributed
21+
22+
@Resolvable
23+
protocol Greeter where ActorSystem: DistributedActorSystem<any Codable> {
24+
distributed func greet(name: String) -> String
25+
}
26+
```
27+
28+
And the module structure to support such applications looks like this:
29+
30+
```
31+
┌────────────────────────────────────────┐
32+
│ API Module │
33+
│========================================│
34+
│ @Resolvable │
35+
│ protocol Greeter: DistributedActor { │
36+
┌───────┤ distributed func greet(name: String) ├───────┐
37+
│ │ } │ │
38+
│ └────────────────────────────────────────┘ │
39+
│ │
40+
▼ ▼
41+
┌────────────────────────────────────────────────┐ ┌──────────────────────────────────────────────┐
42+
│ Client Module │ │ Server Module │
43+
│================================================│ │==============================================│
44+
│ let g = try $Greeter.resolve(...) /*new*/ │ │ distributed actor EnglishGreeter: Greeter { │
45+
│ try await greeter.hello(name: ...) │ │ distributed func greet(name: String) { │
46+
└────────────────────────────────────────────────┘ │ "Greeting in english, for \(name)!" │
47+
/* Client cannot know about EnglishGreeter type */ │ } │
48+
│ } │
49+
└──────────────────────────────────────────────┘
50+
```
51+
852
* [SE-0423][]:
953
You can now use `@preconcurrency` attribute to replace static actor isolation
1054
checking with dynamic checks for witnesses of synchronous nonisolated protocol
@@ -10453,6 +10497,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1045310497
[SE-0430]: https://github.com/apple/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md
1045410498
[SE-0418]: https://github.com/apple/swift-evolution/blob/main/proposals/0418-inferring-sendable-for-methods.md
1045510499
[SE-0423]: https://github.com/apple/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md
10500+
[SE-0428]: https://github.com/apple/swift-evolution/blob/main/proposals/0428-resolve-distributed-actor-protocols.md
1045610501
[#64927]: <https://github.com/apple/swift/issues/64927>
1045710502
[#42697]: <https://github.com/apple/swift/issues/42697>
1045810503
[#42728]: <https://github.com/apple/swift/issues/42728>

0 commit comments

Comments
 (0)