@@ -1957,23 +1957,17 @@ is a sequence of integers.
19571957
19581958## Implicit Constraints
19591959
1960- In addition to the constraints you write explicitly,
1961- many places in your generic code
1962- also include implicit constraints
1963- that require types to conform to some very common protocols
1964- like [ ` Copyable ` ] [ ] .
1965- <!-- When SE-0446 is implemented, add Escapable above -->
1966- For information on when a protocol is implied,
1967- see the reference for that protocol.
1968-
1969- [ `Copyable` ] : https://developer.apple.com/documentation/swift/copyable
1970-
1971- These constraints are implicit because
1972- almost all types in Swift conform to these protocols,
1973- so you specify only the exceptions.
1960+ In addition to constraints you write explicitly,
1961+ many places in your generic code also implicitly require
1962+ conformance to some very common protocols like [ ` Copyable ` ] [ ] .
1963+ <!-- When SE-0446 is implemented, add Escapable above. -->
1964+ These generic constraints that you don't have to write
1965+ are known as * implicit constraints* .
19741966For example, both of the following function declarations
19751967require ` MyType ` to be copyable:
19761968
1969+ [ `Copyable` ] : https://developer.apple.com/documentation/swift/copyable
1970+
19771971``` swift
19781972function someFunction< MyType> { ... }
19791973function someFunction< MyType: Copyable> { ... }
@@ -1988,8 +1982,12 @@ types also implicitly conform to these common protocols.
19881982For more information,
19891983see < doc:Protocols#Implicit-Conformance-to-a-Protocol > .
19901984
1985+ Because most types in Swift conform to these protocols,
1986+ writing them almost everywhere would be repetitive.
1987+ Instead, by marking only the exceptions,
1988+ your call out the places that omit a common constraint.
19911989To suppress an implicit constraint,
1992- you write the protocol name with a tilde (` ~ ` ) in front of it.
1990+ write the protocol name with a tilde (` ~ ` ) in front of it.
19931991You can read ` ~Copyable ` as "maybe copyable" ---
19941992this suppressed constraint allows
19951993both copyable and noncopyable types in this position.
@@ -2024,6 +2022,10 @@ must be passed as in-out, borrowing, or consuming parameters ---
20242022for more information,
20252023see < doc:Declarations#Borrowing-and-Consuming-Parameters > .
20262024
2025+ For details about when generic code
2026+ includes an implicit constraint to a given protocol,
2027+ see the reference for that protocol.
2028+
20272029<!--
20282030 TODO: Generic Enumerations
20292031 --------------------------
0 commit comments