paint-brush
How Rust Was Born: The Story Of A Mistakeby@tomaszs
903 reads
903 reads

How Rust Was Born: The Story Of A Mistake

by Tom Smykowski October 31st, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The journey of Rust, from inception to widespread adoption, unveils the pursuit of memory safety and programming efficiency.

People Mentioned

Mention Thumbnail
featured image - How Rust Was Born: The Story Of A Mistake
Tom Smykowski  HackerNoon profile picture


We all know stories about how other programming languages were born. But what about Rust?


Rust is the language that surprisingly escaped the Cambrian explosion of programming languages, leaving behind Ada, D and OCaml, and more.


Graydon Hoare found a niche in the market of programming languages. He noticed you could write performant systems in crazy C or C++ style or use Java—a safe, resource-hungry beast.


There was nothing in between that was able to fill the void. His initial idea was to solve some major problems of low-level programming.


One of these issues is memory safety. In languages like JavaScript, you don’t care where your variables and arrays are stored. Nothing bad ever happens in that area. If you want to access an array element outside the bounds, you get an error, and that’s it.


But the reality for low-level programming languages is different.


It’s a constant fight with memory leaks and errors.


C and C++ let you do almost everything. You can, for example, create an array with ten elements and read eleven elements from that array.


Guess what happened in the standard C and C++ code? You got data from outside of the array. A piece of data that was stored right next to the array.


A similar situation professionally called a buffer overrun happened to Cloudflare in 2017, showing how risky it is to use languages, code, and compilers that allow access to the memory without limitations.

By such bugs, services can deliver the private data of one user to another user or can be exploited on a global scale by hackers. So, no fun in that.


Graydon idea circled around the concept of a language that is a replacement for C and C++ and fixes common memory errors by guiding and blocking access to data outside of the scope of the app, something called a memory safety.


His work was caught on by Mozilla, yes the organization behind Firefox, which saw it as an opportunity to improve the security of the browser.


On the road to developing the language we know today, there were a lot of ups and downs. Specifically, early versions were dramatically changed from one release to another. Something that turned out to be a good move.


For a while, there were even experiments with garbage collection, but these were dropped, resulting in the fast language that we know today.


There were a lot of contributing factors to Rust's success. But the major one is it solves a problem everyone has. You can’t imagine how many errors in electronic devices are caused by memory issues, including your doorbell.


Rust also shows that you have to be willing to make a lot of mistakes to achieve something meaningful.


With Rust, we were working with the brightest minds in the programming language design boom, and they even had to wipe the board in public several times until they got it right.

It’s inspiring because it shows that to achieve something, we have to wipe out the word “mistake” from our vocabulary.


I see this attitude in many talented people. They spend a lot of time properly describing what they want to achieve and focus on sticking to that goal they believe in.

They don’t worry or consider mistakes as something that should diminish their work. They rather treat such events as an opportunity to understand better the problem they are facing.


Rust inventors and all the specialists involved in its development set the goal clear. A language that is super fast and memory-safe. Seeing a widespread adoption of Rust across industries, they achieved it.


For us all, it’s a piece of great news because all the electronics we use, from toothpaste dispensers to satellites, will be more reliable and safe. This means fewer bugs and happy people.


We can also apply the same attitude to our lives and just enjoy the process and enjoy all the exploration opportunities life gives us.