You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+26-26Lines changed: 26 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
31
31
access to a value provided by the caller, or by `consuming` a value that the
32
32
callee is allowed to take ownership of:
33
33
34
-
```
34
+
```swift
35
35
structHealthyFoods {
36
36
var values: [String] = []
37
37
@@ -269,10 +269,10 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
269
269
New types representing time and clocks were introduced. This includes a protocol `Clock` defining clocks which allow for defining a concept of now and a way to wake up after a given instant. Additionally a new protocol `InstantProtocol` for defining instants in time was added. Furthermore a new protocol `DurationProtocol` was added to define an elapsed duration between two given `InstantProtocol` types. Most commonly the `Clock` types for general use are the `SuspendingClock` and `ContinuousClock` which represent the most fundamental clocks for the system. The `SuspendingClock` type does not progress while the machine is suspended whereas the `ContinuousClock` progresses no matter the state of the machine.
`Clock` also has methods to measure the elapsed duration of the execution of work. In the case of the `SuspendingClock` and `ContinuousClock` this measures with high resolution and is suitable for benchmarks.
@@ -294,17 +294,17 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
294
294
`any` type having the same constraints as the associated type. For example:
295
295
296
296
```swift
297
-
protocolSurface {...}
298
-
299
-
protocolSolid {
300
-
associatedtypeSurfaceType: Surface
301
-
funcboundary() -> SurfaceType
302
-
}
303
-
304
-
let solid: any Solid =...
305
-
306
-
// Type of 'boundary' is 'any Surface'
307
-
let boundary = solid.boundary()
297
+
protocolSurface {...}
298
+
299
+
protocolSolid {
300
+
associatedtypeSurfaceType: Surface
301
+
funcboundary() -> SurfaceType
302
+
}
303
+
304
+
let solid: any Solid =...
305
+
306
+
// Type of 'boundary' is 'any Surface'
307
+
let boundary = solid.boundary()
308
308
```
309
309
310
310
Protocol methods that take an associated type or `Self` cannot be used with `any`,
@@ -317,32 +317,32 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
317
317
Protocols can now declare a list of one or more _primary associated types_, which enable writing same-type requirements on those associated types using angle bracket syntax:
318
318
319
319
```swift
320
-
protocolGraph<Vertex, Edge> {
321
-
associatedtypeVertex
322
-
associatedtypeEdge
323
-
}
320
+
protocolGraph<Vertex, Edge> {
321
+
associatedtypeVertex
322
+
associatedtypeEdge
323
+
}
324
324
```
325
325
326
326
You can now write a protocol name followed by type arguments in angle brackets, like
327
327
`Graph<Int, String>`, anywhere that a protocol conformance requirement may appear:
328
328
329
329
```swift
330
-
funcshortestPath<V, E>(_: some Graph<V, E>, from: V, to: V) -> [E]
330
+
funcshortestPath<V, E>(_: some Graph<V, E>, from: V, to: V) -> [E]
331
331
332
-
extensionGraph<Int, String> {...}
332
+
extensionGraph<Int, String> {...}
333
333
334
-
funcbuild() ->some Graph<Int, String> {}
334
+
funcbuild() ->some Graph<Int, String> {}
335
335
```
336
336
337
337
A protocol name followed by angle brackets is shorthand for a conformance requirement,
338
338
together with a same-type requirement for the protocol's primary associated types.
339
339
The first two examples above are equivalent to the following:
340
340
341
341
```swift
342
-
funcshortestPath<V, E, G>(_: G, from: V, to: V) -> [E]
343
-
where G: Graph, G.Vertex== V, G.Edge== E
342
+
funcshortestPath<V, E, G>(_: G, from: V, to: V) -> [E]
0 commit comments