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

Contributing to Swift

Contributing to Swift

Before Swift was open sourced, our only way to communicate with Apple was through Radar. Filing Radars is an arcane, opaque, and frequently frustrating process. But now we have a whole host of ways to chat directly to Apple engineers, all the way from mailing lists to Twitter messages. Even better than that we can actually dig through large bits of the code we use every day, and see how it works. And then when we find something we think could be better we can fix it! Thats exactly what I did, and last summer a small piece of my code shipped with Xcode 8, and most of you have probably used it. In this talk I’ll tell the story of exactly how that came to be, and explore ways that you can get involved too.

Neil Kimmett

August 16, 2017
Tweet

More Decks by Neil Kimmett

Other Decks in Programming

Transcript

  1. Contributing
    to Swift
    by @neilkimmett

    View Slide

  2. Contributing
    to Swift
    - a little revision
    - story of my contribution
    - ways you can contribute
    - gnarly details

    View Slide

  3. struct CGPoint {
    var x: CGFloat
    var y: CGFloat
    }
    struct CGSize {
    var width: CGFloat
    var height: CGFloat
    }
    struct CGRect {
    var origin: CGPoint
    var size: CGSize
    }

    View Slide

  4. struct CGPoint {
    static var zero: CGPoint
    }
    struct CGSize {
    static var zero: CGSize
    }
    struct CGRect {
    static var zero: CGRect
    }
    x: 0
    y: 0
    width: 0
    height: 0
    origin: {0, 0}
    size: {0, 0}

    View Slide

  5. view.frame.origin =
    let view = UIView()

    .zero

    View Slide

  6. struct UIEdgeInsets {
    var top: CGFloat
    var left: CGFloat
    var bottom: CGFloat
    var right: CGFloat
    }

    View Slide

  7. view.layoutMargins =
    let view = UIView()

    UIEdgeInsetsZero
    .zero

    View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. View Slide

  13. View Slide

  14. View Slide

  15. http://bugreport.apple.com/

    View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. http://bugreport.apple.com/

    View Slide

  20. View Slide

  21. https://swift.org

    View Slide

  22. https://github.com/apple/swift

    View Slide

  23. View Slide

  24. View Slide

  25. View Slide

  26. View Slide

  27. View Slide

  28. View Slide

  29. View Slide

  30. View Slide

  31. View Slide

  32. View Slide


  33. View Slide

  34. View Slide

  35. View Slide

  36. https://github.com/apple/swift/pull/1323

    View Slide

  37. View Slide

  38. View Slide

  39. View Slide

  40. View Slide

  41. What can I do?

    View Slide

  42. “To be a truly great community, Swift.org
    needs to welcome developers from all walks
    of life, with different backgrounds, and with a
    wide range of experience. A diverse and
    friendly community will have more great ideas,
    more unique perspectives, and produce more
    great code. We will work diligently to make the
    Swift community welcoming to everyone.”

    View Slide

  43. https://lists.swift.org

    View Slide

  44. https://stylemac.com/hirundo/

    View Slide

  45. https://apple.github.io/swift-evolution/

    View Slide

  46. https://swiftweekly.github.io

    View Slide

  47. https://spec.fm/podcasts/swift-unwrapped

    View Slide

  48. @jckarter
    Joe Groff
    @UINT_MIN
    Jordan Rose
    @dgregor79
    Doug Gregor
    @tkremenek
    Ted Kremenek
    @ericasadun
    Erica Sadun
    @modocache
    Brian Gesiak

    View Slide

  49. View Slide

  50. https://bugs.swift.org

    View Slide

  51. https://github.com/apple/swift

    View Slide

  52. Ninja

    View Slide

  53. brew install cmake ninja

    View Slide

  54. git clone https://github.com/apple/swift.git
    mkdir swift-source
    cd swift-source
    ./swift/utils/update-checkout --clone

    View Slide

  55. View Slide

  56. ./swift/utils/build-script -h
    ./swift/utils/build-script -R -t

    View Slide

  57. LLVM

    View Slide

  58. LLVM
    IR
    x86
    executable
    clang
    swift
    Haskell
    ARM
    PowerPC
    frontend backend

    View Slide

  59. .swift
    AST SIL
    LLVM
    IR
    assembly
    executable
    parse SILGen
    IRGen
    LLVM

    View Slide

  60. swiftc
    -dump-ast
    -emit-silgen
    -emit-sil
    -emit-ir
    -emit-assembly
    add.swift

    View Slide

  61. let x = 1 + 1
    print(x)
    add.swift

    View Slide

  62. swiftc -dump-ast add.swift

    View Slide

  63. swiftc -dump-ast add.swift

    View Slide

  64. swiftc -emit-silgen add.swift | xcrun swift-demangle

    View Slide

  65. swiftc -emit-silgen add.swift | xcrun swift-demangle

    View Slide

  66. swiftc -emit-silgen add.swift | xcrun swift-demangle

    View Slide

  67. swiftc -emit-silgen add.swift | xcrun swift-demangle

    View Slide

  68. swiftc -emit-silgen add.swift | xcrun swift-demangle

    View Slide

  69. swiftc -emit-sil add.swift | xcrun swift-demangle

    View Slide

  70. swiftc -emit-ir add.swift | xcrun swift-demangle

    View Slide

  71. swiftc -emit-assembly add.swift | xcrun swift-demangle

    View Slide

  72. https://nicoleorchard.com/blog/compilers

    View Slide

  73. https://github.com/apple/swift-evolution
    Swift 5

    View Slide

  74. - ABI stability required
    - Generics and String features for stdlib
    - Memory ownership model
    - Source breaking changes have even higher bar than
    Swift 4
    - Every evolution proposal requires working
    implementation with test cases
    Swift 5

    View Slide

  75. No-one has any idea
    what they’re doing

    View Slide

  76. https://www.youtube.com/watch?v=GnT2ZeHVJe4

    View Slide

  77. https://news.realm.io/news/tryswift-jesse-squires-contributing-open-
    source-swift/
    Jesse Squires - Contributing to Open Source Swift

    View Slide

  78. https://news.realm.io/news/slug-russ-bishop-contributing-open-
    source-swift-proposal/
    Russ Bishop - Contributing to Swift: From Proposal to Shipped

    View Slide

  79. View Slide

  80. View Slide

  81. Thanks!
    from @neilkimmett

    View Slide