Skip to content

Commit c70c364

Browse files
Merge branch 'main' into dalton/update-accessor-macro-docs
2 parents 64300d1 + f365934 commit c70c364

File tree

5 files changed

+40
-53
lines changed

5 files changed

+40
-53
lines changed

Style.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,25 @@ when it‘s the actual agent performing the action.
313313
We don’t distinguish between the parts of the compiler
314314
like the parser or the lexer or the optimizer.
315315

316+
## upcoming features
317+
318+
Starting with the implementation of
319+
[SE-0362: Piecemeal adoption of upcoming language improvements][SE-0362],
320+
some language features are available on an opt-in basis
321+
before being enabled by default.
322+
323+
At the beginning of a section or chapter about a future feature,
324+
include a note as follows.
325+
326+
> Note:
327+
> This language feature will be part of Swift *n*.
328+
> To enable it in current versions of Swift,
329+
> use the feature identifier `SomeFeatureIdentifier`.
330+
> For information about enabling future language features,
331+
> see [Enabling future language features](FIXME).
332+
333+
[SE-0362]: https://github.com/apple/swift-evolution/blob/main/proposals/0362-piecemeal-future-features.md
334+
316335
# Tone
317336

318337
In general, and especially in the guide,

TSPL.docc/GuidedTour/GuidedTour.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ or it responds with a description of what went wrong.
16241624
The server response is a simple way to essentially re-implement Optional
16251625
while sidestepping the fact that I'm doing so.
16261626
1627-
"Out of cheese" is a reference to a Terry Pratchet book,
1627+
"Out of cheese" is a reference to a Terry Pratchett book,
16281628
which features a computer named Hex.
16291629
Hex's other error messages include:
16301630

TSPL.docc/LanguageGuide/AccessControl.md

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -169,61 +169,29 @@ and compile that product module with testing enabled.
169169
## Access Control Syntax
170170

171171
Define the access level for an entity by placing
172-
one of the `open`, `public`, `internal`, `fileprivate`, or `private` modifiers
172+
one of the modifiers listed in <doc:AccessControl#Access-Levels>,
173+
such as `public` or `private`,
173174
at the beginning of the entity's declaration.
175+
For example:
174176

175177
```swift
176-
open class SomeOpenClass {}
177178
public class SomePublicClass {}
178-
internal class SomeInternalClass {}
179-
fileprivate class SomeFilePrivateClass {}
180-
private class SomePrivateClass {}
181-
182-
open var someOpenVariable = 0
183-
public var somePublicVariable = 0
184-
internal let someInternalConstant = 0
185-
fileprivate func someFilePrivateFunction() {}
179+
internal struct SomeInternalStruct() {}
186180
private func somePrivateFunction() {}
187181
```
188182

189-
<!--
190-
- test: `accessControlSyntax`
191-
192-
```swifttest
193-
-> open class SomeOpenClass {}
194-
-> public class SomePublicClass {}
195-
-> internal class SomeInternalClass {}
196-
-> fileprivate class SomeFilePrivateClass {}
197-
-> private class SomePrivateClass {}
198-
199-
-> open var someOpenVariable = 0
200-
-> public var somePublicVariable = 0
201-
-> internal let someInternalConstant = 0
202-
-> fileprivate func someFilePrivateFunction() {}
203-
-> private func somePrivateFunction() {}
204-
```
205-
-->
206-
207-
Unless otherwise specified, the default access level is internal,
183+
The code above declares `SomePublicClass` as public,
184+
`SomeInternalStruct` as internal,
185+
and `somePrivateFunction()` as private.
186+
If you don't write an explicit access level,
187+
the default access level modifier is `internal`,
208188
as described in <doc:AccessControl#Default-Access-Levels>.
209-
This means that `SomeInternalClass` and `someInternalConstant` can be written
210-
without an explicit access-level modifier,
211-
and will still have an access level of internal:
189+
For example, in the code below, `SomeInternalStruct` is implicitly internal:
212190

213191
```swift
214-
class SomeInternalClass {} // implicitly internal
215-
let someInternalConstant = 0 // implicitly internal
192+
struct SomeInternalStruct() {}
216193
```
217194

218-
<!--
219-
- test: `accessControlDefaulted`
220-
221-
```swifttest
222-
-> class SomeInternalClass {} // implicitly internal
223-
-> let someInternalConstant = 0 // implicitly internal
224-
```
225-
-->
226-
227195
## Custom Types
228196

229197
If you want to specify an explicit access level for a custom type,

TSPL.docc/LanguageGuide/Concurrency.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ Each task in a given task group has the same parent task,
555555
and each task can have child tasks.
556556
Because of the explicit relationship between tasks and task groups,
557557
this approach is called *structured concurrency*.
558-
The explicit parent-child relationships between tasks has several advantages:
558+
The explicit parent-child relationship between tasks has several advantages:
559559

560560
- In a parent task,
561561
you can't forget to wait for its child tasks to complete.
@@ -590,7 +590,7 @@ The code above creates a new task group,
590590
and then creates child tasks
591591
to download each photo in the gallery.
592592
Swift runs as many of these tasks concurrently as conditions allow.
593-
As soon a child task finishes downloading a photo,
593+
As soon as a child task finishes downloading a photo,
594594
that photo is displayed.
595595
There's no guarantee about the order that child tasks complete,
596596
so the photos from this gallery can be shown in any order.
@@ -669,7 +669,7 @@ Downloading pictures could take a long time
669669
if the pictures are large or the network is slow.
670670
To let the user stop this work,
671671
without waiting for all of the tasks to complete,
672-
the tasks need check for cancellation and stop running if they are canceled.
672+
the tasks need to check for cancellation and stop running if they are canceled.
673673
There are two ways a task can do this:
674674
by calling the [`Task.checkCancellation()`][] type method,
675675
or by reading the [`Task.isCancelled`][`Task.isCancelled` type] type property.
@@ -1092,7 +1092,7 @@ The code above is similar to
10921092
but the code in this example doesn't wait for the UI update.
10931093
You can also write `@MainActor` on a structure, class, or enumeration
10941094
to ensure all of its methods and all access to its properties
1095-
to run on the main actor:
1095+
run on the main actor:
10961096

10971097
```swift
10981098
@MainActor
@@ -1106,7 +1106,7 @@ The `PhotoGallery` structure in the code above
11061106
draws the photos on screen,
11071107
using the names from its `photoNames` property
11081108
to determine which photos to display.
1109-
Because `photoNames` effects the UI,
1109+
Because `photoNames` affects the UI,
11101110
code that changes it needs to run on the main actor
11111111
to serialize that access.
11121112

@@ -1369,7 +1369,7 @@ during that period of time.
13691369
In the future,
13701370
if you try to add concurrent code to this function,
13711371
introducing a possible suspension point,
1372-
you'll get compile-time error instead of introducing a bug.
1372+
you'll get a compile-time error instead of introducing a bug.
13731373

13741374

13751375
## Global Actors
@@ -1379,7 +1379,7 @@ An actor can normally have multiple instances,
13791379
each of which provides independent isolation.
13801380
This is why you declare all of an actor's isolated data
13811381
as instance properties of that actor.
1382-
However, because `MainActor` is singleton ---
1382+
However, because `MainActor` is a singleton ---
13831383
there is only ever a single instance of this type ---
13841384
the type alone is sufficient to identify the actor,
13851385
allowing you to mark main-actor isolation using just an attribute.

TSPL.docc/ReferenceManual/Statements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ conditions listed in the table below.
10051005
| Platform condition | Valid arguments |
10061006
| ------------------ | --------------- |
10071007
| `os()` | `macOS`, `iOS`, `watchOS`, `tvOS`, `visionOS`, `Linux`, `Windows` |
1008-
| `arch()` | `i386`, `x86_64`, `arm`, `arm64` |
1008+
| `arch()` | `arm`, `arm64`, `i386`, `wasm32`, `x86_64`, |
10091009
| `swift()` | `>=` or `<` followed by a version number |
10101010
| `compiler()` | `>=` or `<` followed by a version number |
10111011
| `canImport()` | A module name |
@@ -1255,7 +1255,7 @@ see <doc:Expressions#Explicit-Member-Expression>.
12551255
> *platform-condition* **`targetEnvironment`** **`(`** *environment* **`)`**
12561256
>
12571257
> *operating-system* **`macOS`** | **`iOS`** | **`watchOS`** | **`tvOS`** | **`visionOS`** | **`Linux`** | **`Windows`** \
1258-
> *architecture* **`i386`** | **`x86_64`** | **`arm`** | **`arm64`** \
1258+
> *architecture* **`arm`** | **`arm64`** | **`i386`** | **`wasm32`** | **`x86_64`** \
12591259
> *swift-version* *decimal-digits* *swift-version-continuation*_?_ \
12601260
> *swift-version-continuation* **`.`** *decimal-digits* *swift-version-continuation*_?_ \
12611261
> *environment* **`simulator`** | **`macCatalyst`**

0 commit comments

Comments
 (0)