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. WHAT'S UP WITH SWIFT 5? BAS BROEK 1 — @basthomas

  2. IOS @ XING MOYA SWIFT WEEKLY BRIEF 2 — @basthomas

  3. ABI STABILITY 3 — @basthomas

  4. ! 4 — @basthomas

  5. ... STOP ME IF YOU THINK YOU'VE HEARD THIS ONE

    BEFORE 5 — @basthomas
  6. SWIFT 5'S PRIMARY FOCUS IS ABI STABILITY 6 — @basthomas

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

    own copy [of the Swift libraries]. 7 — @basthomas
  8. ! 8 — @basthomas

  9. REQUIREMENTS > Generics features in the standard library > API

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

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

    > SE-0157: Recursive constraints on associated types 11 — @basthomas
  12. 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
  13. 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
  14. REQUIREMENTS > Generics features in the standard library > API

    resilience > Memory ownership model 14 — @basthomas
  15. 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
  16. MEMORY OWNERSHIP MODEL > The Law of Exclusivity > The

    standard library must adopt ownership annotations on parameters 16 — @basthomas
  17. SOURCE STABILITY > Source compatibility mode > Supports Swift 4,

    maybe Swift 3 17 — @basthomas
  18. 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
  19. SWIFT EVOLUTION 19 — @basthomas

  20. 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
  21. EVOLUTION PROCESS > Proposals need a working implementation > ...

    including test cases 21 — @basthomas
  22. ! 22 — @basthomas

  23. HOW DO I KEEP UP WITH ALL OF THIS? >

    Swift Weekly Brief > Swift Unwrapped 23 — @basthomas
  24. THANKS! @BASTHOMAS 24 — @basthomas

  25. 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