Hacker News new | ask | show | jobs
by bschoepke 127 days ago
Rust certainly helps for certain classes of errors but doesn't help at all for logic errors or incompletely understood requirements or occasional need for hacks due to business needs.
4 comments

Why is everyone always referring to logic errors when pushing back against Rust? No programming language ever invented (or to be invented) will fix logic errors made by developers.

Logic errors are "out of scope" for Rust or any other programming language.

The Rust type system helps you catch logic errors at compile time. Same with Haskell or Ocaml.
Note: when people say this about Haskell they mean "it has ADTs".
It basically completely eliminates the most common class of errors which are bugs related to memory management. Hard numbers and statistics show that every application with enough complexity will be riddled with those.

It is simply impossible, even for the smartest human minds, to manage this kind of complexity. And this is a fact.

Somehow, magically, some people managed to write C software that I now use for three decade with not a single crash in all this time.
What software would that be, and how do you know there have never been memory-related bugs and vulnerabilities in it?
Basically all C programs I use, shells, editors, terminals, etc. But I do not claim that there "never has been a memory-related bug" but that it is not "riddled with" memory-related bugs, which I would expect would have manifested in at least one segfault over all these years, which I did not observe.
That's like saying a condom isn't 100% effective so you just use the pull-out method instead.
It does help for logic errors too, with, eg, sum types and traits and abstraction.

Also better defaults.