Last week I was lucky enough to attend Apple’s WWDC. The most exciting development was the announcement of the Swift programming language. Suddenly the conference tag line, “Write the code. Change the world.” made sense. Although they billed it as re-imagination of Objective-C without the baggage of C, it is fundamentally much more than that. Swift is a world changing development and it has the potential to be something even bigger than Apple, if they allow it.
Over the last several years, Apple had been stockpiling C++ language experts whose work I very much admire. I can’t imagine how hard it must have been to keep this project in secret for all of these years and I am sure they are glad it has finally been announced to the world.
Strong typing, generics, type inference, closures, optionals, interactivity, efficiency, predictability, safety. These are all great features. Bjarne Stroustrup, when asked why he created C++ said that it was to create a language in which you could make an abstraction but still afford it. For all of the greatness of C++, it does have its wrinkles brought on by time and enslaved to compatibility requirements of C and older versions of itself.
Like C++, Swift too paves the way to affordable abstractions. In a future where we measure performance in terms of operations per watt, Swift will do very well. Attempts have been made to make ruby faster (and I love ruby) but the language definition fundamentally constrains how fast it can be. It is difficult to optimize a number that might dynamically morph into a string.
Swift isn’t afraid to break with the past. For example, one of my biggest complaints with Objective-C (other than manual reference counting in the pre-ARC days) was the handing of passing messages through nil. Although this was touted as a strength, it always seemed wrong to me. Many times it has been a source of strange errors. Swift goes pretty much in the other direction. Although with the ?. chaining syntax, it is still possible to parsimoniously express the intent of expecting nil objects explicitly.
For all its strengths the language is expected to evolve significantly over the next few months. I am looking forward to seeing how access control is implemented and how frameworks that don’t expose implementation can be shared. Java has a solution for this and Swift will likely follow a similar path. What the Swift team was able to accomplish for WWDC was amazing and I looking forward to what upcoming developments await.
In the coming days I will be learning much more about Swift as well as teaching others what I learn. Definitely at the Saturday meetup, and perhaps a little bit here.