Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's up with Swift 5?

Bas Broek
September 23, 2017

What's up with Swift 5?

This talk was presented at FrenchKit 2017.

Bas Broek

September 23, 2017
Tweet

More Decks by Bas Broek

Other Decks in Programming

Transcript

  1. This would remove the need for apps to distribute their

    own copy [of the Swift libraries]. 7 — @basthomas
  2. REQUIREMENTS > Generics features in the standard library > API

    resilience > Memory ownership model 9 — @basthomas
  3. REQUIREMENTS > Generics features in the standard library > API

    resilience > Memory ownership model 10 — @basthomas
  4. GENERICS FEATURES IN THE STANDARD LIBRARY > SE-0143: Conditional conformances

    > SE-0157: Recursive constraints on associated types 11 — @basthomas
  5. CONDITIONAL CONFORMANCES // Swift 4 extension Array: Equatable where Element:

    Equatable { // ERROR: Extension of type 'Array' with constraints // cannot have an inheritance clause } // Swift 5 extension Array: Equatable where Element: Equatable { var hashValue: Int { ... } } 12 — @basthomas
  6. RECURSIVE CONSTRAINTS ON ASSOCIATED TYPES // Will not compile in

    Swift 4, will in Swift 5 protocol Sequence { associatedtype SubSequence: Sequence where Iterator.Element == SubSequence.Iterator.Element, SubSequence.SubSequence == SubSequence // Returns a subsequence containing all but the first 'n' items // in the original sequence. func dropFirst(_ n: Int) -> Self.SubSequence // ... } 13 — @basthomas
  7. REQUIREMENTS > Generics features in the standard library > API

    resilience > Memory ownership model 14 — @basthomas
  8. MEMORY OWNERSHIP MODEL > Partly implemented in Swift 4 (SE-0176:

    Enforce Exclusive Access to Memory) > Swift 5 takes on "only" everything that is needed for ABI stability 15 — @basthomas
  9. MEMORY OWNERSHIP MODEL > The Law of Exclusivity > The

    standard library must adopt ownership annotations on parameters 16 — @basthomas
  10. SOURCE STABILITY GUIDELINES The current implementation must: > actively cause

    problems for users > be clearly better and must not conflict with existing Swift syntax > have a reasonably automated migration path for existing code 18 — @basthomas
  11. PROPOSALS > String ergonomics > Improvements to existing standard library

    facilities > Foundation improvements > Syntactic additions > Laying the groundwork for a new concurrency model > ... and more? 20 — @basthomas
  12. HOW DO I KEEP UP WITH ALL OF THIS? >

    Swift Weekly Brief > Swift Unwrapped 23 — @basthomas
  13. REFERENCES Swift 5.0 goals SE-0143: Conditional conformances SE-0157: Support recursive

    constraints on associated types SE-0176: Enforce Exclusive Access to Memory ABI Stability Manifesto Ownership Manifesto String Manifesto Chris Lattner's Concurrency Manifesto Moya Swift Weekly Brief Swift Unwrapped 25 — @basthomas