Upload
xebia-france
View
309
Download
0
Embed Size (px)
Citation preview
10 lessons we can learnfrom the 36,303 (and counting)
Swift commits(And it's not a clickbait)
1. Everything has abeginning
Makefilelib/Lex/Lexer.cpplib/Lex/Makefilelib/Makefilelib/Parse/Makefilelib/Parse/Parser.cpptools/Makefiletools/swift/Makefiletools/swift/swift.cpp
swift.cpp
int main() {
}
11 commits later
386 commits later
2/A. SVN is not dead yet(At least not to everybody)
2/B. If you struggle with
gityou're not
alone
3. 36% of Swiftis written in Swift
4. ♥ is in the stdlib
Some examples...→ Optionals→ Array
→ Dictionary
...Other examples→ String→ Int→ Bool→ Bit
5. I tawt I taw a python
6. Generate Your Boilerplate
Template%{integerBinaryOps = [ (x[:-1], x[-1], x[:-1].capitalize(), 'a result') for x in 'add+ subtract- multiply* divide/'.split()] + [ ('remainder', '%', 'Divide', 'the remainder') ]}%
Usagepublic protocol _IntegerArithmeticType {% for name,_,Action,result in integerBinaryOps: /// ${Action} `lhs` and `rhs`, returning ${result} and a `Bool` that is /// true iff the operation caused an arithmetic overflow. static func ${name}WithOverflow(lhs: Self, _ rhs: Self) -> (Self, overflow: Bool)% end}
7. Comment your complexity
/// Insert `newElement` at index `i`. /// /// Invalidates all indices with respect to `self`. /// /// - Complexity: O(`self.count`). public mutating func insert(newElement: Character, atIndex i: Index) { withMutableCharacters { (inout v: CharacterView) in v.insert(newElement, atIndex: i) } }
8. We are the facilitatorsof our own creative evolution
github.com/apple/swift-evolution
Commonlyrejectedchanges
github.com/apple/swift-evolution/blob/master/commonly_proposed.md
March, 21st 2016
Swift 2.2Integrates the community feedback
9. We all code by night
10. It's (too) easy to complain aboutsomeone else's code
Thanks!
Simone Civetta@viteinfinite
Sources
→ Swift Weekly Brief by Jesse Squires→ Swift Evolution Mailing List
→ github.com/apple