03: Source Stability (What is a Source Breaking Change?)
The up (and down) sides of striving for source compatibility across Swift versions. Let's rearrange some deck chairs!
Every Swift developer who has migrated code bases from Swift 1.x to 2.x, or even the more tedious 2.x to 3.x knows the pain of migrating to new Swift versions.
In this episode, we cover:
- What is a source breaking change?
- Almost guaranteeing that code that compiles with Swift 3.0 continues to compile with Swift 3.x and even Swift 4.x in Swift 3 mode. Why almost? Because it may be best to prevent code that never should have compiled with Swift 3.0 (i.e. compiled due to egregious bugs in the compiler) from compiling as those bugs are fixed. There are times when breaking compilation is preferable to continuing to exploit Swift bugs.
- "we should try to get the “rearrange all the deckchairs” changes into Swift 3 if possible, to make Swift 3 to 4 as smooth as possible": https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160125/007737.html
- Community-driven breakage ;)
- Slava Pestov (@slava_pestov) found and fixed a 'horrific' Swift 3 compatibility bug. When they say Swift 3.1 will be compatible with Swift 3, they're serious. 😅
- Dollar Sign
- Swift Weekly
- Issue 39, https://swiftweekly.github.io/issue-39/
- Slava Pestov changed variadic closure arguments to be @escaping by default, which is technically a source breaking change, but only for invalid code.
- Issue 42, https://swiftweekly.github.io/issue-42/
- Robert Widmann merged changes to reject standalone $ as identifiers, which were accidentally accepted as valid.
- Issue 43, https://swiftweekly.github.io/issue-43/
- Rintaro Ishizaki has submitted a pull request to fix SR-2843. In type parsing, P1 & P2.Type (new protocol syntax) was incorrect.
- DougGregor fixed an unintentional source-breaking change from Swift 3 regarding implicitly-unwrapped optionals and type inference.
- Minor source breaking change for sugared types: https://github.com/apple/swift/commit/4ebac86895383ad15e34de3671c6f423e96cfc98
- Running the entire test suite with version 3 or 4: https://github.com/apple/swift/commit/1fcd7d725d1c23a27d4ea31e34e20f182e0b8c37
- Ignored Labels for single-"Any"-argument functions
- Xcode 8.2 last release for Swift 2.3!
- Tanner Nelson was behind the
Type.self proposal, not Erica Sadun: https://github.com/apple/swift-evolution/blob/master/proposals/0090-remove-dot-self.md