Apple's new Swift coding language hopes to lock down errors
Apple's new computer language Swift promises to prevent the programming problems that have plagued its predecessors.
Apple Vice President Craig Federighi didn't have a Steve Jobsian "one more thing" for the faithful at the Worldwide Developers Conference on Monday morning. But he did end on an unexpected note. Apple debuted a new programming language called Swift that the company hopes will make coding faster while eliminating catastrophic errors.
"We have a new programming language. The language is called Swift, and it totally rules," said Federighi as the crowd exploded with applause.
Swift is native to Apple's Cocoa and Cocoa Touch frameworks on which OS X and iOS are respectively built. Federighi outlined an ambitious goal to replace the Objective-C and Python languages with a single language that is faster and easier to code in.
"It's impressive that they've managed to develop a full-fledged modern replacement entirely in secret -- as well as a little concerning, given how difficult it can be to evolve a language design in isolation," said Landon Fuller, a developer and the chief technology officer at the developer co-operative firm Plausible Labs.
"By designing a language like Swift independently, they were able to produce something that interoperates seamlessly with their existing platform," Fuller said.
Swift promises to be a sort of a holy grail for developers, employing the best of C and Objective C without its compatibility restrictions. It also promises to put an end to the "infinite loop" errors, of which the recent "goto fail" debacle was a part of.
Swift promises to blaze past Objective-C and Python, with complex object sort 3.9 times faster and RC4 encryption 220 times faster than Python. Federighi promised that developers simply won't be able to make entire classes of errors that currently plague them, even though code written in Swift will be able to run alongside current Objective-C code.
Chris Lattner, Apple's director of developer tools, then took the stage to demo how quickly the language can be tested. He wrote a few lines of code in Swift that assigned values of a variable to the position of a blimp in his demo development environment, and the app was instantly able to show the blimp moving. No building or compiling was required.
Although there have been a lot of programming languages introduced in recent years, including Dart, Go, Rust, Haxe, and TypeScript, their progenitors have found it hard to make them stick.
Gordon Haff, a Red Hat Linux cloud evangelist and longtime developer advocate, expressed disappointment on Twitter that Apple opted to develop a proprietary language instead of choosing a more open platform.
For Apple's operating systems, "if you want to do mobile development, you pretty much have to use what Apple provides," Haff said.
That could also be an indicator that Swift will succeed where other languages have languished, because Apple essentially has a captive audience of enthusiastic developers.
"Whether this has an impact beyond Apple will likely depend on whether Apple makes Swift available as an open-source project," Fuller said. "There's a lot of renewed interest in implementing compiled, efficient, safe languages, and from what I've seen of Swift's design, it's a worthwhile entrant in the space."
Corrected at 5:33 p.m. PST Swift is 220 times faster than Python, not Objective-C.
Update at 5:04 p.m. PST with additional comments.