The Programming Language That’s Changing the World

Screenshot+of+Rust+code

Rust’s beautiful syntax

Almost everybody has used a computer before; whether it be for work, school, or even personal leisure, computers have managed to work their way into each of our daily lives. But how can computers understand us? At their most basic level, computers don’t even come close to speaking English. Abstracted completely, computers are just sand that man tricked into thinking through millions of 1’s and 0’s. And that’s how a computer works at its core; an extensive collection of logic gates and circuits that somehow compound into the complex machines that most people know them as. This is the language of computers, also known as binary or machine code. Now, as you can imagine, binary is not very understandable to humans. Writing any program completely in binary would take an intimate knowledge of the operating system that almost no one possesses, so a medium between humans and computers is required. This medium is a programming language. A programming language is, simply put, a language that helps humans communicate with computers. As you may have guessed, we use programming languages to write programs, which are sets of logical instructions for the computer to execute. When writing a program, there are several different options for languages to write it in, each lending their own unique strengths for different projects and situations. Popular options include Python, C, Javascript, Java, C++, and thousands more. All of these languages are used worldwide in almost every single device you touch, but they are not without fault. Each of these examples has a plethora of problems. Python lacks granular system control, C is incredibly insecure, Javascript runs the modern web; but lacks basic functionality that’s often expected of a programming language, Java is plagued with bloat that makes for a poor developer experience, and C++ is a good language but overly complex. However, in recent years, one language has come up with solutions to all these problems: Rust.

The Rust Programming Language was first created in 2006 by Graydon Hoare, a Mozilla employee. After seeing its potential, Mozilla began sponsoring the project in 2009. The language continued development and eventually became the Rust we know and love today. Emphasis should be placed on the “love” part of that statement, as Rust has ranked #1 as the “most loved” language by developers since 2016, according to the Stack Overflow Developer Survey

Rust aims to have C’s speed and low-level control, but the readability and ease of use of Python. Traditional high-level languages use something called a garbage collector. While a program is running, the garbage collector goes through the code, finds pieces of the code that are no longer needed, and frees the memory that they are stored in. While garbage collection is helpful, it can slow down performance by an order of magnitude. Because of this, the fastest languages are often older, one of the reasons being a lack of a garbage collector. In a comparison of programming language speed when calculating pi 100 million times, all of the top performers lack garbage collectors. Fortran 90, C, and C++ are all at the top of the list, but Rust is between these languages in second place, only six milliseconds away from first. This is bizarre, because high-level languages, like Rust, sacrifice performance for readability and ease of use. However, Rust, a high-level language, is so optimized that it often compiles machine code nearly identical to that of C. Somehow, it achieves this speed with complete memory safety, which C can’t guarantee. Rust does this by utilizing its revolutionary borrow-checker. The details of the borrow-checker are complicated, but basically, instead of garbage collection, Rust has a concept called ownership. Ownership guarantees that an object’s memory will be freed if it goes out of the scope of the currently running part of the program, and if an object is moved somewhere else, it cannot be reaccessed in its original scope, so it must be passed by reference. This sounds like nerdy computer science jargon, but all it means is that Rust won’t run into the same memory errors as older languages because it doesn’t allow for memory-unsafe code to be written; it stops the developer from shooting themself in the foot. 

Rust is a relatively young language, but it’s already making waves in the business world. Amazon Web Services (AWS), the largest cloud service provider in the world, uses Rust in production to build its infrastructure; from the AWS Open Source Blog-  “AWS loves Rust.” Notably, messaging platform Discord rewrote its backend from Go, another programming language, to Rust because of the speed improvements and lack of a garbage collector, as the former was causing routine lag spikes. The language is also growing in developer support by major tech companies. AWS and Dropbox have both introduced official software development support for the language. Still, the community itself has a wide range of solutions for every platform you might want to write for. Even if there isn’t a pre-existing library for whatever you want to do, nearly anything is possible with the language’s rich HTTP request libraries and system control. I’ve personally used Rust for writing command line tools and personal projects, and it’s already my favorite language to work in. 

Despite all of this, Rust is not without flaws. Although it has maintained its spot as the most loved language by developers, it ranks fairly low in popularity for real-world use. According to the TIOBE Index, Rust is ranked as the 18th most used language in the world, ranking behind the ancient Visual Basic and even Object Pascal. This being said, the job market around Rust is very small. Rust isn’t quite creating jobs yet, but once more companies follow the trend of using Rust in production, jobs are sure to follow. Another common criticism is the language’s steep learning curve and often difficult syntax. The Rust ecosystem is also relatively young. Many important libraries for Rust development are immature and might not be at the same level as their equivalents in other languages. Most of the issues with Rust stem from the environment surrounding it, not the language itself. The parity between C++ and Rust shows in the comparable speed of the two, but also the compile time. Rust is terribly slow in compilation times. Build times of over an hour have been reported for some larger projects. Since Rust offers incremental compilation, smaller parts of the program can be compiled individually, but compile times remain generally slow. This slowness could be attributed to the use of a Low Level Virtual Machine (LLVM) backend for both the Rust compiler and the clang compiler for C++, but there isn’t enough evidence to support this claim. The language can still compete in all corners of computer science, including web development. Rust web frameworks, particularly Leptos, have been making waves in web development, even beating React, the most popular web framework in the world, in performance.

The Rust programming language offers solutions to problems that have plagued the programming community for decades. Rust has been by far the most enjoyable language I’ve ever programmed in, and I would recommend it to any intermediate programmers who are interested in learning more about low-level development, as well as general best practices for code. However, I would not recommend it to new programmers as learning the language’s type safety and borrow checker might be a daunting task to overcome. This article barely even scratches the surface of what makes this language great. Amazing parts of the Rust ecosystem include Cargo, Clippy, Rustup, rust-analyzer, and Docs.rs; great tools that enhance the developer experience. The language itself features functions like macros, security, Options and Results, Unsafe, zero-cost abstraction, and efficient C bindings. As long as the upwards trend of companies using Rust in production continues, the future of the language is bright. The way I see it, Rust isn’t a better C or a better Python but an entirely new step in the evolution of programming. Rust is not a fad and is certainly a language I would keep an eye on.