Skip to content

Commit b594d32

Browse files
committed
chor(): Revert formatting from blog post.
1 parent 0509d9a commit b594d32

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

_posts/2024-09-17-announcing-swift-6.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Read on for a deep dive into changes to the language, standard libraries, debugg
1919

2020
### Concurrency
2121

22-
Swift has long offered memory safety, ensuring that variables are initialized before they’re used, memory isn’t accessed after it’s been deallocated, and array indices are checked for out-of-bounds errors. Swift 6 now includes a new, opt-in language mode that extends Swift’s safety guarantees to prevent data races in concurrent code by diagnosing potential data races in your code as compiler errors.
22+
Swift has long offered memory safety, ensuring that variables are initialized before they’re used, memory isn’t accessed after it’s been deallocated, and array indices are checked for out-of-bounds errors. Swift 6 now includes a new, opt-in language mode that extends Swift’s safety guarantees to prevent data races in concurrent code by diagnosing potential data races in your code as compiler errors.
2323

2424
Data-race safety checks were previously available as warnings in Swift 5.10 through the `-strict-concurrency=complete` compiler flag. Thanks to improved `Sendable` inference and new compiler analysis for transferring mutable state from one actor to another, Swift 6 warnings about data-race safety have fewer false positives. You can find more information about the Swift 6 language mode and how to migrate at [Swift.org/migration](http://swift.org/migration).
2525

@@ -34,8 +34,8 @@ Swift 6 enables functions to specify the type of error that they throw as part o
3434
For example:
3535

3636
```swift
37-
func parseRecord(from string: String) throws(ParseError) -> Record {
38-
// ...
37+
func parseRecord(from string: String) throws(ParseError) -> Record {
38+
// ...
3939
}
4040
```
4141

@@ -55,8 +55,8 @@ Typed throws can also be used in generic functions to propagate error types from
5555

5656
```swift
5757
extension Sequence {
58-
func map<T, E>(_ body: (Element) throws(E) -> T) throws(E) -> [T] {
59-
// ...
58+
func map<T, E>(_ body: (Element) throws(E) -> T) throws(E) -> [T] {
59+
// ...
6060
}
6161
}
6262
```
@@ -115,19 +115,19 @@ Swift 6 rounds out the set of low-level integer primitives with the addition of
115115

116116
### Productivity enhancements
117117

118-
Swift 6 introduces a number of productivity enhancements, including [`count(where:)`](<https://developer.apple.com/documentation/swift/sequence/count(where:)>) to streamline counting the number of elements in a sequence that satisfy a predicate, [pack iteration](https://www.swift.org/blog/pack-iteration/) for writing natural `for`-loops over the elements in a value parameter pack, access control for imports to keep implementation details from leaking into your public APIs, `@attached(body)` macros for synthesizing and augmenting function implementations, expression macros as default arguments, and more.
118+
Swift 6 introduces a number of productivity enhancements, including [`count(where:)`](https://developer.apple.com/documentation/swift/sequence/count(where:)) to streamline counting the number of elements in a sequence that satisfy a predicate, [pack iteration](https://www.swift.org/blog/pack-iteration/) for writing natural `for`-loops over the elements in a value parameter pack, access control for imports to keep implementation details from leaking into your public APIs, `@attached(body)` macros for synthesizing and augmenting function implementations, expression macros as default arguments, and more.
119119

120120
You can find a complete list of language proposals that were accepted through the [Swift Evolution](https://github.com/swiftlang/swift-evolution) process and implemented in Swift 6 on the [Swift Evolution dashboard](https://www.swift.org/swift-evolution/#?version=6.0).
121121

122122
## Debugging
123123

124-
### Custom LLDB summaries with <code>@DebugDescription</code>
124+
### Custom LLDB summaries with `@DebugDescription`
125125

126126
Swift 6 provides a new debugging macro to easily customize how an object is displayed in LLDB when using the `p` command, and in the variables view in Xcode and VSCode, by using a formatting scheme that does not run arbitrary code.
127127

128128
Types that conform to `CustomDebugStringConvertible` provide a `debugDescription` property that returns a string describing the object. In LLDB, the `po` command calls this computed property on an object. In contrast, the `p` command uses LLDB’s type summary formatters to directly format the object using its stored property values.
129129

130-
[`@DebugDescription`](<https://developer.apple.com/documentation/swift/debugdescription()>) is a new macro in the standard library which lets you specify LLDB type summaries for your own types directly in code. The macro processes the `debugDescription` property, translating simple string interpolations involving stored properties into LLDB type summaries. This allows LLDB to use your custom formatting even when using `p`, and also in Xcode or VSCode’s variable display windows. The macro can use an existing conformance to `CustomDebugStringConvertible`, or you can provide a separate string interpolation only for use in LLDB’s `p` command. Providing a separate LLDB description string is useful if your `CustomDebugStringConvertible` implementation doesn’t meet the requirements of the `@DebugDescription` macro, or if you’re familiar with the [LLDB Summary String syntax](https://lldb.llvm.org/use/variable.html#summary-strings) and you want to use it directly.
130+
[`@DebugDescription`](https://developer.apple.com/documentation/swift/debugdescription()) is a new macro in the standard library which lets you specify LLDB type summaries for your own types directly in code. The macro processes the `debugDescription` property, translating simple string interpolations involving stored properties into LLDB type summaries. This allows LLDB to use your custom formatting even when using `p`, and also in Xcode or VSCode’s variable display windows. The macro can use an existing conformance to `CustomDebugStringConvertible`, or you can provide a separate string interpolation only for use in LLDB’s `p` command. Providing a separate LLDB description string is useful if your `CustomDebugStringConvertible` implementation doesn’t meet the requirements of the `@DebugDescription` macro, or if you’re familiar with the [LLDB Summary String syntax](https://lldb.llvm.org/use/variable.html#summary-strings) and you want to use it directly.
131131

132132
For example, the following code customizes how `po` in LLDB displays the `Organization` type with a conformance to `CustomDebugStringConvertible`, and the `@DebugDescription` macro exposes this custom formatting to the `p` command and the variables view:
133133

@@ -147,7 +147,7 @@ struct Organization: CustomDebugStringConvertible {
147147

148148
```
149149
(lldb) p myOrg
150-
(Organization) myOrg = "`#100 Worldwide Travel [Jonathan Swift]`"
150+
(Organization) myOrg = "`#100 Worldwide Travel [Jonathan Swift]`"
151151
```
152152

153153
### Improved startup performance with explicit modules
@@ -185,7 +185,7 @@ func mentionedContinents(videoName: String) async throws {
185185

186186
Swift Testing takes full advantage of macros. Its `@Test` and `@Suite` attached macros declare test functions and suite types respectively, and they accept arguments (known as traits) to customize various behaviors. The `#expect` and `#require` expression macros validate expected behaviors, and capture rich representation of expressions and their sub-values to produce detailed failure messages.
187187

188-
Since Swift Testing is included directly in Swift 6 toolchains, you can `import Testing` without needing to declare a package dependency. This means your tests do not need to build Swift Testing or its dependencies (including swift-syntax), and its macro implementation comes prebuilt. The package manager in Swift 6 automatically builds and runs Swift Testing tests in addition to XCTests (if present), and shows results from both libraries in log output. Swift Testing supports all platforms that Swift officially supports, including all Apple platforms, Linux, and Windows.
188+
Since Swift Testing is included directly in Swift 6 toolchains, you can `import Testing` without needing to declare a package dependency. This means your tests do not need to build Swift Testing or its dependencies (including swift-syntax), and its macro implementation comes prebuilt. The package manager in Swift 6 automatically builds and runs Swift Testing tests in addition to XCTests (if present), and shows results from both libraries in log output. Swift Testing supports all platforms that Swift officially supports, including all Apple platforms, Linux, and Windows.
189189

190190
To learn more about this new open source project, visit the [swift-testing](https://github.com/swiftlang/swift-testing) repository on GitHub, and get involved with its ongoing development [on the forums](https://forums.swift.org/c/related-projects/swift-testing/103).
191191

0 commit comments

Comments
 (0)