Google engineers recently introduced “Carbon”, an open-source programming language hailed as the possible successor to C++. With the new “experimental” language making the internet the talk, conversations about why “Rust” didn’t become the official successor to C++ also surfaced.
With its own community of people called ‘Rustaceae‘ who use, contribute to, and have an interest in language development, Rust is a statically typed programming language for performance and security, especially secure concurrency and memory management. Its syntax is similar to that of C++. The open-source project was originally developed at Mozilla Research. In 2021, the Rust Foundation took the torch and led the development of the language.
In his presentation At CPP North, Google engineer Chandler Carruth advised those who used “Rust” to keep using it. Carbon is for developers with large C++ code bases, which are difficult to convert to Rust. Carbon is specifically what Carruth called a “successor language”, built on top of an already existing ecosystem, C++ in this case.
According to a StackOverflow Survey, Rust is considered one of the fastest growing programming languages and has been ranked as the most loved language by its users. But, programmers say otherwise.
A good language should be safe, fast and easy to program. But is it Rust?
Rust is hard. It has a complex syntax and a steep learning curve. It is designed to uniquely solve some very difficult programming problems. However, as a beginner, using Cuda or MPI on Rust is not very easy compared to other options like Swift and Go. Moreover, it is slow. Rust is a snail compared to other languages. Even for small projects, compile times are painfully long, and runtime metrics show Rust to be less efficient than C programs.
Imagine rewriting C libraries that have undergone decades of scrutiny only to introduce new bugs. Bugs in code are a programmer’s nightmare. While this saves developers some mistakes, it doesn’t prevent them from inadvertently writing bugs. Another issue is constant warnings appearing above parentheses, especially on if statements and while loops.
Rust is therefore much more complicated and inefficient and could soon be replaced by said tooling.
Not so unpopular after all?
Even though first-hand experiences tell a different story, most big tech companies are already using Rust, while others are considering doing so. Recently, Rust joined Meta’s panel of officially supported server-side programming languages. The list previously included C++, Hack, and Python.
“There is a rapidly growing Rust footprint in our products and services, and we are committed to Rust for the long term and welcoming early adopters,” says Eric Garcia, Head of Meta Software Engineering.
Dropbox uses Rust for certain critical elements of its programming. Other Internet companies would probably choose Rust when they need good security, multi-threading, and to reduce the amount of hardware. For example, a highly efficient web service written in Rust can save millions of hardware dollars for a company running thousands of servers.
Google is also planning use rust in the Linux kernel after bringing support for the Rust system programming language to Android. As a reminder, the objective is to reduce security vulnerabilities. In the meantime, Microsoft too turned to Rust to reduce memory-related bugs in Windows components. Currently there are 25 repositories on GitHub from Public Works Microsoft made with Rust. Most of them have occasional commits, which is tiny compared to the 317 C++ repositories.
Facebook has also strengthened ties with Rust by joining the Rust Foundation, an organization created in 2021 to make Rust “a mainstream language of choice for systems programming and beyond.”
In 2020, Linux kernel developers proposed to rewrite new Linux kernel code in Rust. The idea was to add new code in Rust to the kernel originally written in C. However, this idea is still in the development stage, described as experimental.
In the future, Rust could become one of the favorite languages for Internet of Things (IoT) devices with tiny processors and little RAM, but requiring a high level of security. Additionally, given its relationship with big tech, it would likely become a language of choice for Internet companies that need to deliver web services to millions of users.