2016-03-20

Rust’s impact on the industry

Mozilla has seen better days. 
Once it offered a serious competitive threat to Microsoft’s Internet Explorer. Today, Mozilla’s Firefox squeaks into third place with just 12% market share of desktop browsers, according to NetMarketShare, and is worse than a rounding error among mobile browsers. Other projects, like Mozilla Thunderbird, are even less relevant. 
Which is why the group’s Rust programming language is so surprising—and potentially industry changing. Hatched by Mozilla employee Graydon Hoare back in 2009, Rust was built from the ground up using “elements from modern programming language design.” Think of it as a fusion of a high-level language’s flexibility and a low level’s firm control. 
Essentially, Mozilla offers a tool that boosts performance and allows developers to create everything from operating systems to databases, all while avoiding the backward compatibility challenges that saddle other languages. In short, Rust has the potential to completely up-end the industry, and make Mozilla more relevant than ever.

Rust Never Sleeps

Mozilla may have lost its way, but it has been doing its best recently to claw its way back to relevancy. Projects like Electrolysis could give Firefox some multiprocess powers, while its new WebAssembly standard (to supercharge the Web) and WebVR virtual-reality streaming offer intriguing new possibilities to support emerging technologies. 
But if you look past those glossy initiatives, you might see that with Rust, Mozilla already has one fundamental way to potentially resurrect itself. And it has had the tool in its back pocket for years. 
Rust started as Hoare’s side project six years ago, but it didn’t get officially blessed as a Mozilla project until 2010. Despite the organization’s affiliation, it considers Rust a community affair, with many committers coming in from the outside. 
Rust is a new programming language which focuses on performance, parallelization, and memory safety. By building a language from scratch and incorporating elements from modern programming language design, the creators of Rust avoid a lot of “baggage” (backward-compatibility requirements) that traditional languages have to deal with. Instead, Rust is able to fuse the expressive syntax and flexibility of high-level languages with the unprecedented control and performance of a low-level language.
It’s that last sentence that’s so beguiling about Rust. It enables developers to write kernels, operating systems, browsers, databases, and more, things that you simply can’t realistically write in a higher-level language like Google’s Go
On one hand Rust is a very modern language. It has generics, traits, it is expression orientated, has pattern matching, closures and a lot of other exciting features. 
On the other hand it is very low level, too. It doesn’t use garbage collection by default. It just defines a couple of new rules that the compiler enforces on you *at compile time* which eliminates the need for a garbage collection…. 
Even more exciting for Burgdorf is that Rust offers deep control over things like memory allocation. “[Rust] also lets you take deep control about heap vs stack allocations that for instance wouldn’t be possible in Go because Go’s compiler uses escape analysis to figure out if something should go on the heap,” he writes. 
Although new programming languages seem to roll out at an ever-increasing rate, Rust may stand out for one simple reason: It allows for low-level language control and performance, without forcing developers to become hardcore low-level programming gurus. 
New languages have an advantage whenever they can make developers’ jobs easier, but boosting their control while doing so makes it even more appealing. 

Rust In Peace

Redmonk’s Stephen O’Grady points to “anecdotal evidence [that] has been accumulating for some time that the language is piquing the interest of developers from a variety of spaces.” 
Those spaces could span works both new and old. As developer Jeff Waugh told me, “I reckon we’ll see lots of new things, both totally new projects and modules for existing projects, embracing Rust.” 
While we may see operating systems, databases, and other projects built from the ground-up using Rust, part of its power is in extending existing projects. Mozilla’s Servo browser engine is a good example. 
“Servo’s interesting because the hard/new bits are in Rust, built on lots of existing stuff,” said Waugh. “Rust…does all the parallel layout stuff and glue. It still uses *Monkey for JavaScript, libpng for PNG loading, etc.” 
So some of the Servo code is Rust. Much isn’t. But the ability to improve Servo (or most any project) over time by building in Rust modules is powerful. This may be particularly true for C-based programs, writes Australian author and programmer Dave Cheney: “Rust code is expected to be embedded in other large programs which follow the C calling convention.” 

Is The Future Rust?

When it comes to Rust, there’s still one nagging question: If it’s so great, why isn’t everyone using it? 
Right now, it’s still (very) hard to find a job that requires Rust, as Hacker News’ hiring trends suggest. Even general interest among programmers remains low, according to Google search data
But let’s not confuse current momentum for long-term industry impact. For instance, it would be easy to look at Go’s popularity against Rust, and conclude that Go wins and Rust loses. 
That’s a false comparison, however, as Cheney explains: “Rust competes for mindshare with C++ and D for programmers who are prepared to accept more complex syntax and semantics (and presumably higher readability costs) in return for the maximum possible performance.” Meanwhile, he adds, “Go competes for mindshare in the post 2006 Internet 2.0 generation of companies who have outgrown languages like Ruby, Python, and Node.js (v8) and have lost patience with the high deployment costs of JVM based languages.” These are very different use cases, and very different audiences. 
I expect Go to continue to grow, but I suspect Rust could have a deep and abiding impact on our industry’s most important programs. 
As Peter Bright declares, “Rust is an attempt to offer the performance and control of a language like C or C++, while making it much harder to write the kind of security-compromising bugs that are abundant in those languages.”
By offering a huge example of Rust in action (Servo/Firefox), Mozilla can help to showcase Rust’s power for C developers (and others) longing for something better. It can also restore itself as a central force in modern application development.