You may have heard already but Swift is now open source! As of 9:09 AM PST the site is still choking under heavy load but the associated github repos are now public.
Grabbing the source:
brew install cmake ninja. Create a main directory to hold all the associated repos, then clone:
git clone firstname.lastname@example.org:/apple/swift.git swift
git clone email@example.com:/apple/swift-llvm.git llvm
git clone firstname.lastname@example.org:/apple/swift-clang.git clang
git clone email@example.com:/apple/swift-lldb.git lldb
git clone firstname.lastname@example.org:/apple/swift-cmark.git cmark
git clone email@example.com:/apple/swift-llbuild.git llbuild
git clone firstname.lastname@example.org:/apple/swift-package-manager.git swiftpm
git clone email@example.com:/apple/swift-corelibs-xctest.git
git clone firstname.lastname@example.org:/apple/swift-corelibs-foundation.git
Everything seems to be controlled by
swift/utils/build-script. To create an Xcode project that an browse/edit the sources (but not do builds) run this command:
swift/utils/build-script -X --skip-build -- --reconfigure. If you omit
--skip-build then you can build the OS X version from Xcode, but not iOS or Linux.
What's in the Box
- Swift compiler
- A Swift package manager (!!)
- A portable version of the Swift Standard Library
- A portable version of Foundation built on the open-source CoreFoundation
- A portable version of GCD built on the open-source
- A portable version of XCTest
- Cmark (a high-performing markdown processor validated with american fuzzy lop!)
sourcekitd aka SourceKit
Portability in this first version means Linux, specifically Ubuntu 14/15. Since Apple will be taking contributions, I'm sure we will see other Unix flavors appear. Given Microsoft's recent commitment to bringing LLVM to Windows as a first-class citizen, we may eventually see Windows support as well.
What isn't included is anything related to Objective-C. Although the core runtime is open-source, Apple chose not to open-source the Objective-C version of Foundation. By extension all of the Objective-C bridging features are not present in the portable builds.
An interesting take on package management; it can recursively resolve dependencies. Packages are declared in Swift code itself and support libraries and separate tools. You specify a git source repo and a version which gets automatically turned into a git tag to look for. I haven't looked into this much deeper yet.
Swift Evolution repo that is tracking releases and features. It lists Fall 2016 as the target release date so there is still plenty of time to argue for features and influence the direction of v3.
Some of the goals for Swift 3:
- ABI stability. This will allow future versions of Swift code to call libraries built with Swift 3.0 without a recompile
- Solving the fragile binary interface problem
- Generics improvements (including making things like an
Accepted changes for Swift 3:
Not included in Swift 3:
If you want to see some of the potential future directions for Swift, you can checkout the proposal docs. I assume this will be the place to put pie-in-the-sky ideas, where the Swift Evolution repo details actual decisions and commitments for upcoming releases. Some existing Swift features are also included here so it is a treasure-trove for understanding how the language evolved.
Concurrency is a very interesting one... proposing a cross-thread mechanism to copy values and some primitives that would allow a library author to create Go-style channels, Actors, or C#-style Async/Await implementations and have the compiler enforce the thread-safety of the code (eg by ensuring the code in a worker thread cannot access any global variables and that all arguments to the thread start function implement the cross-thread copy protocol).
RemoteMirrors is another interesting proposal for out-of-process introspection for debugging and other purposes.
Versioned Libraries looks like a great proposal that naturally extends
@available to support versions of any library, along with tools for library authors to handle changes.
These are just proposals, not commitments to features so take them with a huge grain of salt.
I'm sure we will all be busy over the holidays checking this stuff out and more details will be forthcoming. I'm looking forward to finding areas where I can make a contribution to help make Swift an even better language; if you have any interest I suggest you do the same!
This blog represents my own personal opinion and is not endorsed by my employer.