Why Elegance Doesn't Make A Language

With the internet all abuzz about Apple's new Swift programming language, it seems we've forgotten what language design is about. While Swift may be simpler and more elegant than other languages, it also lacks some very important parts of a programming language - parts that make or break long-term support of the community.

David Gerwitz published an article at ZDNet analyzing Swift, and declaring that it "might be the new BASIC." There are a few reasons why Swift absolutely cannot, in its current state, become such an industry giant and educational touchstone in code as BASIC has been for decades.

A large part of the adoption of languages is how quickly you can develop in them. Swift seems to have gotten that part down pat, with its simple syntax and libraries for interacting with Apple APIs. The simplicity of languages such as BASIC and Python allows quick authoring of code due to the minimal translation between the syntax of the English language and the syntax of the code. Swift looks as if it takes many cues from the syntax of BASIC and the objective behavior of C++, so while it's not as simple as it could be, it's definitely close to human language. However, as someone who learned programming from his use of BASIC, I look at Swift and worry about some of the more complex concepts it assumes you understand; just from the simple "Balloons" demo they display on their website, you can already see maps and class attributes, some things that shouldn't, in my opinion, have been carried over from Objective-C to make a truly beginner-friendly language.

Something that is integral to most, if not all, programming languages is formatting. Formatting is something that, more often than not, frustrates and punishes new learners of the language. Even as a relatively experienced programmer, I still miss a semicolon or right brace every so often and kick myself for it when I get a compile error. Languages like BASIC and Python require minimal formatting; mainly placement of indentation. While some prefer writing their programs in their own indentation scheme, I believe that languages forcing users to indent is a good thing, because it means teaching beginners to keep their code legible. As long as it's nothing crazier than a single tab or even a single whitespace, it's a perfectly viable strategy to force users to indent. It's not punishing, and it looks good.

As much as I don't believe it can become the next BASIC, Swift may be a holy grail of programming across Apple devices. Sadly, that simple stipulation of "Apple devices" may ruin it for the future. Objective-C could have overtaken C# or even C++ if Apple had cared enough to make it cross-platform; but that's not part of their business plan. Their inventions are theirs; nobody else gets to use them, the minimum cross-compatibility for anything is implemented merely to meet standards and appease end-users. BASIC was such a wonderful and widely-adopted language because it was cross-platform; a simple language able to be compiled and executed on all major system architectures. Nobody wants to have to write the same application multiple times. There's a terrible trend in app development where someone writes an app for an iPhone or an Android device, not expecting it to get popular, and then they're suddenly flooded with demands to port it to the other system. Often, they use abstraction layers or pay other developers to do the porting; ruining the structure and elegance of their code because they don't know both languages. Unless Apple wants to widen this divide (which, given their stance on iOS development in the past, wouldn't be out of character for them at all), they need to create a truly cross-platform implementation of Swift.

While I love seeing new languages pop up, I also think that Swift is one that I and many other developers will skip. As a non-regular user of Apple devices, I would much rather spend my time writing in another rapid development language like Python or even Java. If Apple decides to stop ignoring the world outside their window and publishes Swift or even XCode for other platforms, I will certainly give it a try; but for the time being, no thanks. I can still write in BASIC.