Slide 1

Slide 1 text

WHAT'S UP WITH SWIFT 5? BAS BROEK 1 — @basthomas

Slide 2

Slide 2 text

IOS @ XING MOYA SWIFT WEEKLY BRIEF 2 — @basthomas

Slide 3

Slide 3 text

ABI STABILITY 3 — @basthomas

Slide 4

Slide 4 text

! 4 — @basthomas

Slide 5

Slide 5 text

... STOP ME IF YOU THINK YOU'VE HEARD THIS ONE BEFORE 5 — @basthomas

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

This would remove the need for apps to distribute their own copy [of the Swift libraries]. 7 — @basthomas

Slide 8

Slide 8 text

! 8 — @basthomas

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

GENERICS FEATURES IN THE STANDARD LIBRARY > SE-0143: Conditional conformances > SE-0157: Recursive constraints on associated types 11 — @basthomas

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

MEMORY OWNERSHIP MODEL > The Law of Exclusivity > The standard library must adopt ownership annotations on parameters 16 — @basthomas

Slide 17

Slide 17 text

SOURCE STABILITY > Source compatibility mode > Supports Swift 4, maybe Swift 3 17 — @basthomas

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

SWIFT EVOLUTION 19 — @basthomas

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

EVOLUTION PROCESS > Proposals need a working implementation > ... including test cases 21 — @basthomas

Slide 22

Slide 22 text

! 22 — @basthomas

Slide 23

Slide 23 text

HOW DO I KEEP UP WITH ALL OF THIS? > Swift Weekly Brief > Swift Unwrapped 23 — @basthomas

Slide 24

Slide 24 text

THANKS! @BASTHOMAS 24 — @basthomas

Slide 25

Slide 25 text

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