▲ | lerno 3 days ago | |
I find some of Rust dev reactions to this article pretty embarrassing. As if memory safety was some holy grail only provided by Rust. Here is a bunch of more memory safe languages that are more popular than Rust: Python, Java, JS ... should I continue? But wait, there's more. Can Rust verify that arbitrary in-data is valid, like having contracts statically checked at compile time? It can't, and so then by the same logic as some people calling non-Rust languages "gibberish" for not having a borrow checker, should we call Rust "gibberish" because it can't check those invariants at compile time like C3 can do? No? Then get off that high horse. And by the way, my great fear is that we'll get more adoption by Rust while at the same time Rust is unable to improve the compile times. C++, Swift and Rust, the three horsemen of infamously long compile times. The borrow checker isn't the main problem, just like C++'s problems isn't complex template messages – it's that both takes so long to compile. Time you could spend reading and testing the code. Long compile times inhibits refactoring and cause bugs to stay unfixed. | ||
▲ | simonask 2 days ago | parent [-] | |
The point about "gibberish" is getting at a fundamental misunderstanding that people have about Undefined Behavior. Rust's concept of "safety" really means "absence of Undefined Behavior". Lots of people don't seem to understand that C, C++, and Zig programs containing UB are gibberish - they are not C, C++, or Zig programs, but something else entirely. The key insight here is that in any language, UB invalidates the entire program. It no longer does what you think it does, your tests are all moot, and so on. But a lot of people seem to think that there is an acceptable amount of UB in any code base. There isn't. UB is a concept that exists for every language, even languages like Python, Java, C#, JavaScript, but those languages make it very hard to encounter accidentally. Before Rust, there was no way to guarantee the absence of UB without a significant runtime cost, so that's a very meaningful invention. |