The best travel apps for a smart, stress-free holiday

Apple's new coding language heralds Swift changes

Chris Lattner spent a year and a half creating a new programming language -- a new way of designing, building, and running computer software -- and he didn't mention it to anyone, not even his closest friends and colleagues.

He started in the summer of 2010, working at night and on weekends, and by the end of the following year, he'd mapped out the basics of the new language. That's when he revealed his secret to the top executives at his company, and they were impressed enough to put a few other seasoned engineers on the project. Then, after another eighteen months, it became a "major focus" for the company, with a huge team of developers working alongside Lattner, and that meant the new language would soon change the world of computing.

Advertisement

Lattner, you see, works for Apple.

The language is called Swift, and on June 2, Apple released a test version to coders outside the company, billing it as a faster and more effective means of building software apps for iPhones, iPads, and Macs. Even then, four years after Lattner first envisioned the language, it came as a shock to all but a limited number of Apple insiders. Vikram Adve was Lattner's graduate adviser at the University of Illinois, Urbana-Champaign, helping him fashion the software that would serve as the foundation for Swift, but Adve was just as surprised as anyone that his former student had spent so many years building a new programming language. "Apple is so tightlipped, and Chris has drunk the Apple Kool-Aid," Adve says, laughing. "I knew he was working on a project that dominated his time, but that's all I knew."

Read next

Stephen Wolfram's language to program everything

ByTom Cheshire

Apple is so tightlipped, and Chris has drunk the Apple Kool-Aid. I knew he was working on a project that dominated his time, but that's all I knew.

Typically, when a new language appears like this -- out of nowhere -- it needs years to reach a mass audience. This is true even if it's backed by a tech giant the size of Apple. Google unveiled a language called Go in 2009, and though it was designed by some of the biggest names in the history of software design -- Ken Thompson and Rob Pike -- it's still struggling to gain a major following among the world's coders. But Swift is a different animal. When it's officially released this fall, it could achieve mass adoption with unprecedented speed, surpassing even the uptake of Sun Microsystems' Java programming language and Microsoft's C# in the late 1990s and early 2000s.

Part of Swift's edge is that it's built for the average programmer. It's designed for coding even the simplest of mobile apps, and with a rather clever tool Apple calls "Playgrounds," it offers an unusually effective way of teaching yourself to code. But the larger point here is that such an enormous number of programmers have an immediate reason to use Swift. Today, hundreds of thousands of developers build apps for iPhones and iPads using a language called Objective-C, and due to the immense popularity of Apple's consumer gadgets, these coders will keep building such apps. But Swift is a significant improvement over Objective-C -- in many respects -- and this means the already enormous community of iPhone and iPad developers are sure to embrace the new language in the months to come. "With Google Go, there was no real incentive to use it," says Paul Jansen, who has tracked the progress of the world's programming languages for nearly fifteen years with the Tiobe Index, an independent, if rather controversial, measure of coder mindshare. "The difference with Swift is that there is incentive."

Advertisement

People will jump to this new language because it's so much easier to code in. They have to use either Objective-C or Swift, and most people will go for Swift.

Coders still need good reasons to make the switch from Objective-C to Swift. After all, they've never worked with Swift -- "I'll be the first and only guy with four years of Swift programming experience," Lattner wrote on Twitter -- and learning something like this requires some time and dedication. Typically, that's a big hurdle to overcome. "Most new languages just don't go anywhere and the few that do, it takes a long, long time for them to get any traction," says Mike Ash, a developer who has spent the last fifteen years building software for Apple hardware and is now delving deeply into the company's new language.

Read next

Facebook's 'Hack' is here to shake up programming

ByCade Metz

But for Ash and others, Lattner and Apple have already provided those good reasons. In and of itself, Swift isn't that much more attractive than many other languages available to the world of software coders, including C#, Ruby, Python, and others. But it's a big advance over Objective-C, a language that dates back to the mid-80s and, frankly, isn't as easy to use as more modern languages. "A lot of people were really put off by Objective-C and its unusual syntax," Ash says. "Swift, with its more regular syntax, standard syntax, can really help with getting those people interested."

Swift is not only more familiar to contemporary coders -- offering things like "generics," basic building blocks you can use over and over again -- it includes several tools designed to better protect programmers from mistakes and bugs. Among other things, it provides what's called "inferred typing," which basically means that coders don't have to spend so much time defining what types of variables they're using. "It's more of a helpful language. It understands what you're doing a little bit better and allows the computer to help you figure it out a bit better," Ash says. "It makes for a more productive programmer. It lets you get more done in less time."

Advertisement

And then there's Playgrounds, which many, including Vikram Adve, call the most interesting aspect of the new language.

Inside the Playgrounds

Playgrounds, Lattner says on his homepage, is meant to make programming "more interactive and approachable." It was heavily influenced, he explains, by the philosophies of a designer named Bret Victor and an existing interactive programming system called Light Table. Much like Light Table, it lets you write code on one side of your computer screen and see the results appear on the other side. In other words, you can watch your program run as you write it.

Read next

Google launches two new programming languages -- but there's no knowing if they'll thrive

ByCaleb Garling

When Lattner helped unveil Swift at Apple's massive developer conference at the beginning of June, he showed how Playgrounds let him make real-time changes to a kind of animated circus game. Basically, the tool can add new code to live software without recompiling and restarting the entire thing. "When you make a change, it injects the change into a running process -- into the version of the program that is currently running," says Chris Granger, one of the creators of Light Table.

I hope that by making programming more approachable and fun, we'll appeal to the next generation of programmers and to help redefine how computer science is taught.

Apple isn't the only one playing in this area. Facebook is trying something similar with languages called Hack and D.

Google is exploring this ground with Go. And Mozilla, maker of the Firefox web browser, is doing much the same with a language known as Rust. In some respects, these languages are much further along than Swift. Facebook is already using Hack to rebuild its massive online service, and Google is using Go to revamp its own internal operation.

What's more, most of these languages are open source, meaning the code behind their designs is freely available to the world at large. They can, in theory, spread more easily to devices and services from other companies. Swift isn't open source -- at least not yet -- and given Apple's history of so tightly controlling its software and hardware, some question whether a certain corporate heavy-handedness will limit the progress of the language. "There are some worries where Apple might limit the language's direction -- being able to write cross-platform code and things that," Ash says, referring to the ability to run the language across non-Apple devices.

Advertisement

Even still, Swift is likely to spread at a speed those other languages can't. Eventually, Ash believes, Apple will open source Swift, and he's confident the language will flourish outside of the company's control -- mainly because the project is run by Lattner, who has a long history with open source software. "With Chris running the show, I think we can trust him to make the right decisions," he says. Before Swift, Lattner created something called Clang, a new program for compiling software. As with Swift, he started the project in secret and then took it to Apple, and the company soon embraced it in big way. The kicker is that Clang was open sourced, and now, it's used by so many others across the industry, including Google.

But even if Swift remains an Apple-only thing, it's impact could be greater than any other language that has sprung up in recent years, and it may achieve mass adoption faster than any language in modern history. Such is the leverage of all those iPhones, iPads, and Macs. Yes, so many other languages can do most of the same stuff that Swift can do -- and some may do it better. In Light Table, there's even an alternative to Playgrounds. But Swift is still unique.