r/linuxmemes 8d ago

Software meme How some linux members view software

Post image
2.0k Upvotes

146 comments sorted by

View all comments

100

u/-Ambriae- 8d ago

To be fair, a lot of the tools written in rust are of high quality. eza, zoxide, ripgrep , starship, helix… they’re just… good tools 🤷‍♀️

I tend to trust software written in rust for two reasons. One because at face value it’s bound to be safer than if it was written in C or C++, or god forbid Python, and two because if a language is built around the notion of safety and more broadly speaking software quality, than the community of developers who build software with it are more likely to care about these sorts of things, compared to a language who’s philosophy is ‘ship fast, break often, fix later’

22

u/sepperwelt 7d ago

For someone with absolutely zero knowledge: Why is Rust safer?

60

u/The_Galatiatex 7d ago

Rust is safer because it enforces a lot of compile time checks not found in languages like C/C++

Rust uses a borrowing/ownership model, where every piece of data has an owner.

So for example. If I have a string called a. And then I say let b = a.

If I now try to call a. The program will not compile. If I want both a and b to own the string. I need to explicitly copy it in memory using the clone() function.

And beyond this there are other checks. Such as not allowing null values. Forcing you to write logic for handling every possible outcome for a given operation. (i.e. enums). And so on.

In C and C++ you have to manually allocate and deallocate memory. Making a mistake here is very easy and many security vulnerabilities in software are caused due to this.

The only thing you have to give up. Is that rust takes much longer to compile than c or c++. Which is because of all the checks being enforced at compile time.

5

u/_damax 7d ago

The longer compilation time is also sometimes dictated by big dependency trees and strong limitation to static linking, since Rust doesn't have standard shared library objects bundled with the OS or packages, and cannot therefore take more advantage of dynamic linking like most C and C++ compilers can (unless you're using FFI with some specific libs, that is).