logoalt Hacker News

adrian_byesterday at 6:22 AM3 repliesview on HN

Rust is one of the safer languages, but saying that it is "the safest language" is just a baseless exaggeration.

Decades before Rust and long before the simplified language that was C, there were safe programming languages, where all invalid operations, numeric overflows or out-of-bounds accesses generated exceptions and where use-after-free was impossible, because either garbage collectors or reference counts were used.

Rust is much safer than C compiled with its bad default compilation options, but it did not bring much in comparison with other languages.

Even in C++, with appropriate rules, restrictions and discipline you can write programs that are guaranteed to be at least as safe as any Rust program, but unfortunately very few use C++ in this way, i.e. by strictly avoiding the features that are obsolete or unsafe.


Replies

vkazanovyesterday at 6:31 AM

I am not a huge Rust fan but the language did bring a few practical and useful innovations, while also keeping a focus on practice.

And no, C++ just doesn't make the same things easy or clean.

And no, "discipline and appropriate rules" were never enough.

show 1 reply
dbdryesterday at 7:43 AM

> Even in C++, with appropriate rules, restrictions and discipline you can write programs that are guaranteed to be at least as safe as any Rust program

If by discipline, you mean running something akin to the borrow checker in your head, that's essentially tautologically true. The issue with that is that it's mentally draining and/or you will still make mistakes sometimes.

show 1 reply
jibalyesterday at 8:19 AM

> with appropriate rules, restrictions and discipline

This completely misses the point.

show 1 reply