Hoare lived on the 21st floor, and climbing the stairs made him irritated. “It’s funny,” he thought, “that we computer guys couldn’t even do.” elevator that works flawlessly!» Hoare knew that many of these crashes were caused by problems with how the program used memory. The software inside devices like elevators is often written in languages ​​like C++ or C, which are known for allowing programmers to write code that runs very quickly and is fairly compact. The problem is that these languages ​​also make it easy to accidentally introduce memory errors – errors that will cause a crash. Microsoft estimates that 70% of the vulnerabilities in its code are related to memory errors from code written in these languages.

Most of us, if we found ourselves on 21 flights of stairs, would just get angry and leave it there. But Hoare decided to do something about it. He opened his laptop and began developing a new computer language that he hoped would allow him to write small, fast, error-free code. He named it Rust, after a group of extremely hardy fungi that he says are “overengineered for survival.”

Seventeen years later, Rust is one of the most popular new languages ​​on the planet—perhaps in the hottest. 2.8 million programmers write on Rust, and companies from Microsoft to Amazon see it as key to their future. Chat platform Discord used Rust to speed up its system, Dropbox uses it to sync files to your computer, and Cloudflare uses it to handle more than 20% of all Internet traffic.

When the developer discussion board Stack Overflow conducts its annual survey of developers around the world, Rust has been ranked as the most “favorite” programming language for seven years in a row. Even the US government is avidly promoting software in Rust as a way to make their processes more secure. The language, like many successful open source projects, has evolved into a barn: there are now hundreds of avid contributors, many of them volunteers. Hoare himself retired from the project in 2013, happily handing it over to other engineers, including the core Mozilla team.

It is not uncommon for someone to create a new computer language. Lots of programmers create small side projects all the time. But it’s rare when one manages to gain a foothold and become part of the pantheon of popular languages ​​alongside, say, JavaScript, Python, or Java. How did Rust do it?

To understand what makes Rust so useful, it’s worth looking under the hood of how programming languages ​​work with computer memory.

You can, very roughly speaking, think of dynamic memory in a computer as a whiteboard. The software at work constantly writes small pieces of data to the board, keeps track of where they are, and deletes them when they’re no longer needed. Different computer languages ​​handle this differently. Older languages ​​like C or C++ are designed to give the programmer a lot of power over how and when the software uses the board. This power is useful: with a lot of control over dynamic memory, an encoder can make software run very fast. This is why C and C++ are often used to write “bare metal” code that interacts directly with the hardware. Machines that don’t have an operating system like Windows or Linux, including everything from dialysis machines to cash registers, run on such code. (It’s also used for more advanced computing: at some point the operating system needs to interact with the hardware. The Windows, Linux, and MacOS kernels are largely written in C.)

“This pleasant writing Rust, which may be strange, but the language is simply fantastic. It’s fun. You feel like a magician, and that doesn’t happen in other languages.”

Parker Zimmerman, software engineer

But as fast as they are, languages ​​like C and C++ have a trade-off. They require the encoder to carefully monitor what memory is being written to and when it is being erased. And if you accidentally forget to erase something? You can cause a crash: software can later try to use memory space it thinks is empty when there really is something there. Or you can give a digital attacker a chance to sneak in. A hacker may discover that a program is improperly clearing its memory—information that should were erased (passwords, financial information) is still hanging around – and sneakily capture this data. As a piece of C or C++ code gets bigger and bigger, even the most careful programmer can make a lot of memory mistakes, filling the software with bugs.

Source by [author_name]

Previous articleChinese tech giants are planning ChatGPT clones – and Beijing is watching closely
Next articleWhy you shouldn’t trust artificial intelligence search engines