Skip to content

Commit 01bf742

Browse files
committed
[CHANGELOG] NFC: Add an entry for SE-0423
1 parent 382cd4c commit 01bf742

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,46 @@
55

66
## Swift 6.0
77

8+
* [SE-0423][]:
9+
You can now use `@preconcurrency` attribute to replace static actor isolation
10+
checking with dynamic checks for witnesses of synchronous nonisolated protocol
11+
requirements when the witness is isolated. This is common when Swift programs
12+
need to interoperate with frameworks written in C/C++/Objective-C whose
13+
implementations cannot participate in static data race safety.
14+
15+
```swift
16+
public protocol ViewDelegateProtocol {
17+
func respondToUIEvent()
18+
}
19+
```
20+
21+
It's now possible for a `@MainActor`-isolated type to conform to
22+
`ViewDelegateProtocol` by marking conformance declaration as `@preconcurrency`:
23+
24+
```swift
25+
@MainActor
26+
class MyViewController: ViewDelegateProtocol {
27+
func respondToUIEvent() {
28+
// implementation...
29+
}
30+
}
31+
```
32+
33+
The compiler would emit dynamic checks into the `respondToUIEvent()` witness
34+
to make sure that it's always executed in `@MainActor` isolated context.
35+
36+
Additionally, the compiler would emit dynamic actor isolation checks for:
37+
38+
- `@objc` thunks of synchronous actor-isolated members of classes.
39+
40+
- Synchronous actor-isolated function values passed to APIs that
41+
erase actor isolation and haven't yet adopted strict concurrency checking.
42+
43+
- Call-sites of synchronous actor-isolated functions imported from Swift 6 libraries.
44+
45+
The dynamic actor isolation checks can be disabled using the flag
46+
`-disable-dynamic-actor-isolation`.
47+
848
* [SE-0418][]:
949

1050
The compiler would now automatically employ `Sendable` on functions
@@ -10366,6 +10406,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1036610406
[SE-0429]: https://github.com/apple/swift-evolution/blob/main/proposals/0429-partial-consumption.md
1036710407
[SE-0432]: https://github.com/apple/swift-evolution/blob/main/proposals/0432-noncopyable-switch.md
1036810408
[SE-0418]: https://github.com/apple/swift-evolution/blob/main/proposals/0418-inferring-sendable-for-methods.md
10409+
[SE-0423]: https://github.com/apple/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md
1036910410
[#64927]: <https://github.com/apple/swift/issues/64927>
1037010411
[#42697]: <https://github.com/apple/swift/issues/42697>
1037110412
[#42728]: <https://github.com/apple/swift/issues/42728>

0 commit comments

Comments
 (0)