3 ms·
> Rust excels in creating correct programs. Correctness means, roughly, that a program is checked by the compiler for unsafe operations, resulting in fewer run
by saagarjha 6y ago
> Rust excels in creating correct programs. Correctness means, roughly, that a program is checked by the compiler for unsafe operations, resulting in fewer runtime errors.
This is a fairly low bar for correctness, and not really one I would really agree with :/
- neutronicus 6y agoLaunching the missiles is memory-safe! Deleting the production database is a thornier philosophical question, but Rust's position is that it is.
- saagarjha 6y agoYeah, there's a couple of issues, one of which you mentioned :) Others are the fact that "runtime errors" are not necessarily bad; the goal is to prevent exploitable runtime errors. Crashing when you detect an out-of-bounds access is a bug and a runtime error, but one that is safe from a security perspective and as such something that Rust will do readily when necessary.
- dbaupp 6y agoCalling just “memory safety” correctness is a low bar and misses all sorts of other correctnesses (type safety, progress, matching-the-spec, etc.). However, it is a fundamental property: without memory safety, no other correctness can be guaranteed.
- tapirl 6y agoSo is it a property more important for inexperienced programmers?
- entha_saava 6y agoYou think only inexperienced programmers cause memory errors? I am no fan of rust and actually hate its evangelism. But this is ridiculous.
- tapirl 6y ago... more ...
- staticassertion 6y agoIt's an extremely low bar, but one that hasn't been met by some popular languages.
- loeg 6y agoThe bar here is C.
- saagarjha 6y agoI think that bar is met by some term which means something synonymous with "this is better than C". When dealing with "correctness" I generally would like the program to do what I intended.
- bilkow 6y agoI agree, and sincerely, I'm a Rust programmer and "memory safety" is definitely not why I use Rust. There are lots of memory safe languages but I feel more productive and get more satisfaction writing Rust than, say, Python, Lua or C++. In Rust I feel like almost every time the program works on the first time it compiles successfully, even without writing tests. Probably a combination of very well designed API, builtin RAII, very explicit syntax, compiler strictness and clear docs. I also cannot forget to handle errors (even if I just decide to propagate or crash). This is what "correctness" means to me, but it isn't exactly enforced by the compiler itself.
- m0xte 6y agoThe bar is set by the worst programmer not the worst language.
- MayorMonty 6y agoThe language works for the programmer. Those with a higher focus on safety (like rust) make the worst programmer better.
- albntomat0 6y agoCombined with the large number of vulnerabilities in mature, well-designed programs implemented by skilled programmers. The mythical programmer that can use C/C++ without bugs doesn't exist.
- deleted 6y ago[deleted]
- oxymoron 6y agoI find that monadic error handling and null safety is as much of a game changer. It gets discussed less, and is obviously not unique to rust, but coming from Java I see what I’d guesstimate to be an order of magnitude difference in unhandled error cases. The same logic can be applied in Java or C++ or probably even C, but it also comes down to the wide spread and idiomatic approaches of the language. The rust eco system is not necessarily coherent around the details of errors, but error handling is generally rigorous. The benefits of that can’t be overstated. The compiler is a huge help in getting it right in a way that Java checked exceptions never was. I’m sure that there are other languages that are showing similar wins, though. I haven’t written much Swift, but I imagine that the experience might be similar?