Skip to content

Commit 91c753a

Browse files
authored
Merge pull request swiftlang#74066 from slavapestov/update-changelog-6.0
[6.0] Update CHANGELOG.md
2 parents 613b321 + 3d37fb0 commit 91c753a

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

CHANGELOG.md

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,47 @@
55
66
## Swift 6.0
77

8+
* Closures can now appear in pack expansion expressions, which allows you to
9+
construct a parameter pack of closures where each closure captures the
10+
corresponding element of some other parameter pack. For example:
11+
12+
```swift
13+
struct Manager<each T> {
14+
let fn: (repeat () -> (each T))
15+
16+
init(_ t: repeat each T) {
17+
fn = (repeat { each t })
18+
}
19+
}
20+
```
21+
22+
* [SE-0431][]:
23+
You can now require a function value to carry its actor isolation
24+
dynamically in a way that can be directly read by clients:
25+
26+
```swift
27+
func apply<R>(count: Int,
28+
operation: @isolated(any) async () -> R) async -> [R]
29+
where R: Sendable {
30+
// implementation
31+
}
32+
```
33+
34+
The isolation can read with the `.isolation` property, which has type
35+
`(any Actor)?`:
36+
37+
```swift
38+
let iso = operation.isolation
39+
```
40+
41+
This capability has been adopted by the task-creation APIs in the
42+
standard library. As a result, creating a task with an actor-isolated
43+
function will now synchronously enqueue the task on the actor, which
44+
can be used for transitive event-ordering guarantees if the actor
45+
guarantees that jobs will be run in the order they are enqueued, as
46+
`@MainActor` does. If the function is not explicitly isolated, Swift
47+
still retains the right to optimize enqueues for functions that actually
48+
start by doing work with different isolation from their formal isolation.
849

950
* [SE-0423][]:
1051
You can now use `@preconcurrency` attribute to replace static actor isolation
@@ -46,6 +87,21 @@
4687
The dynamic actor isolation checks can be disabled using the flag
4788
`-disable-dynamic-actor-isolation`.
4889

90+
* [SE-0420][]:
91+
`async` functions can now explicitly inherit the isolation of their caller
92+
by declaring an `isolated` parameter with the default value of `#isolation`:
93+
94+
```swift
95+
func poll(isolation: isolated (any Actor)? = #isolation) async -> [Item] {
96+
// implementation
97+
}
98+
```
99+
100+
When the caller is actor-isolated, this allows it to pass isolated state
101+
to the function, which would otherwise have concurrency problems. The
102+
function may also be able to eliminate unwanted scheduling changes, such
103+
as when it can quickly return in a fast path without needing to suspend.
104+
49105
* [SE-0418][]:
50106

51107
The compiler would now automatically employ `Sendable` on functions
@@ -10405,15 +10461,19 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1040510461
[SE-0407]: https://github.com/apple/swift-evolution/blob/main/proposals/0407-member-macro-conformances.md
1040610462
[SE-0408]: https://github.com/apple/swift-evolution/blob/main/proposals/0408-pack-iteration.md
1040710463
[SE-0411]: https://github.com/apple/swift-evolution/blob/main/proposals/0411-isolated-default-values.md
10408-
[SE-0417]: https://github.com/apple/swift-evolution/blob/main/proposals/0417-task-executor-preference.md
1040910464
[SE-0412]: https://github.com/apple/swift-evolution/blob/main/proposals/0412-strict-concurrency-for-global-variables.md
1041010465
[SE-0413]: https://github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
10411-
[SE-0422]: https://github.com/apple/swift-evolution/blob/main/proposals/0422-caller-side-default-argument-macro-expression.md
10412-
[SE-0427]: https://github.com/apple/swift-evolution/blob/main/proposals/0427-noncopyable-generics.md
1041310466
[SE-0414]: https://github.com/apple/swift-evolution/blob/main/proposals/0414-region-based-isolation.md
10414-
[SE-0430]: https://github.com/apple/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md
10467+
[SE-0417]: https://github.com/apple/swift-evolution/blob/main/proposals/0417-task-executor-preference.md
1041510468
[SE-0418]: https://github.com/apple/swift-evolution/blob/main/proposals/0418-inferring-sendable-for-methods.md
10469+
[SE-0420]: https://github.com/apple/swift-evolution/blob/main/proposals/0420-inheritance-of-actor-isolation.md
10470+
[SE-0422]: https://github.com/apple/swift-evolution/blob/main/proposals/0422-caller-side-default-argument-macro-expression.md
1041610471
[SE-0423]: https://github.com/apple/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md
10472+
[SE-0427]: https://github.com/apple/swift-evolution/blob/main/proposals/0427-noncopyable-generics.md
10473+
[SE-0429]: https://github.com/apple/swift-evolution/blob/main/proposals/0429-partial-consumption.md
10474+
[SE-0430]: https://github.com/apple/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md
10475+
[SE-0431]: https://github.com/apple/swift-evolution/blob/main/proposals/0431-isolated-any-functions.md
10476+
[SE-0432]: https://github.com/apple/swift-evolution/blob/main/proposals/0432-noncopyable-switch.md
1041710477
[#64927]: <https://github.com/apple/swift/issues/64927>
1041810478
[#42697]: <https://github.com/apple/swift/issues/42697>
1041910479
[#42728]: <https://github.com/apple/swift/issues/42728>

0 commit comments

Comments
 (0)