Unwrapping Swift

Developers have had plenty to say about Swift since its announcement at this year’s Worldwide Developers Conference. It sure seems like only a matter of time before it supplants Objective-C as the programming language of choice on (at least?) Apple platforms. But the far-reaching legacy of Swift may be its departure from customary object-oriented paradigms.

Simple, or Easy?

It borrows adapted let expressions and other functional language grammar by way of static code analysis, and (at least in theory) supports rich interactive editing inspired by projects like Light Table and this talk by Bret Victor. It’s refreshing to see capabilities like these in a language with serious platform support, and bodes well for hopes of better, perhaps more collaborative, developer tools. So while a lot of analyses have focused on performance and compatibility, I want to consider Swift’s potential impact on the practice of software development.


A lot of the criticisms of Swift so far focus on missing features—dynamism and introspection are limited, freeform initialization is disallowed, and so on. While some facets of the language are probably just incomplete, there’s a bigger picture here. Programming languages can help developers write better code through both the inclusion and exclusion of features. A language that makes it easy to follow effective design patterns and hard to follow poor ones is more pragmatic than a language that makes it equally easy to follow both.

One reason to start fresh with a new language is to rethink assumptions. New features can be grafted onto an established language, but it’s difficult to remove anything that a lot of legacy code depends on. As features accumulate, even if they’re useful, the language as a whole loses consistency and focus (C++ epitomizes this tendency). In a way, good programming languages can’t please everyone—not if simplicity is valued at more than a surface level.


An unfocused language is also harder to learn. Chris Lattner, who spearheaded Swift’s development, has mentioned that his team intends for it to be “a great teachable language”. Rather than requiring a lot of domain knowledge upfront, language concepts in Swift are supposed to be discoverable and learned incrementally, along the lines of scripting languages like Python. This becomes important when paired with interactive editing, because it really affects being able to learn through experimentation. Having gotten my start with tools like ProjectFUN and GameMaker as a kid, I can vouch for the speed of learning by trial and error.

In the meantime, Swift is still an interesting and fun language to play around with—and the foundations are in place for some promising future developments.