3 ms·
I think the idea is like: it took extra work 'cause Rust makes you be so explicit about allocations and types, but it's also probably faster/more reliable becau
by westoncb 11mo ago
I think the idea is like: it took extra work 'cause Rust makes you be so explicit about allocations and types, but it's also probably faster/more reliable because that work was done.
Of course at the end of the day it's just marketing and doesn't necessarily mean anything. In my experience the average piece of Rust software does seem to be of higher quality though..
- echelon 11mo agoEven forgetting the memory safety and async safety guarantees, the language design produces lower defect code by a wide margin. Google and other orgs have written papers about this. There are no exceptions. There are no nulls. You're encouraged to return explicit errors. No weird error flags or booleans or unexpected ways of handling abnormal behaviors. It's all standardized. Then the language syntax makes it easy to handle and super ergonomic and pleasurable. It's nice to handle errors in Rust. Fully first class. Result<T,E>, Option<T>, match, if let, if let Ok, if let Some, while let, `?`, map, map_err, ok_or, ok_or_else, etc. etc. It's all super ergonomic. The language makes this one of its chief concerns, and writing idiomatic Rust encourages you to handle errors smartly. Because errors were so well thought out, you write fewer bugs. Finally, the way the language makes you manage scope, it's almost impossible to write complicated nesting or difficult to follow logic. Hard to describe this one unless you have experience writing Rust, but it's a big contributor to high quality code. Rust code is highly readable and easy to reason about (once you learn the syntax). There are no surprises with Rust. It's written simply and straightforwardly and does what it says on the tin.
- shuraman7 11mo agoare you for real? Rust most definitely is not highly readable and the language reeks of complexity
- danielheath 11mo agoReadable is relative; it’s much less readable than some languages, but much more than the ones it’s largely displacing. I would much rather try and figure out a bug in unfamiliar rust than in unfamiliar cpp.
- echelon 11mo agoIt's comparable with Java. It's significantly easier to parse than C++.
- hu3 11mo agoJava doesn't have lifetimes. So no. And C++ can only be beaten by the likes of K, J and brainfuck. Very low bar to clear.
- phplovesong 11mo agoThats not special to rust in any way or form. Most of mentioned features are stolen from ML, and in some cases badly. Eg rust has unwrap thats basically a ticking time bomb waiting to blow up. Rust has many other ways to blow up the program. Its not only about memory safety (80% of rust apps in the wild dont benefit from "memory safety" in any way or form).
- Tadpole9181 11mo agoOkay, but the alternative isn't ML; virtually all of this software would otherwise be written in C or C++.
- tcfhgj 11mo agoIMHO every app benefits from memory safety. Memory safety doesn't only have security implications, but reduces crashes, misbehavior and corrupt data. You don't want either in any software, which has to fulfill a task in a productive way.
- phplovesong 11mo agoSure, but a GC gives you that. Having manual memory management (like in C) is something only a very few applications REALLY need. Hell i have seen web frontends written in rust. Now the circle is complete.
- tcfhgj 11mo ago1. It doesn't give you that necessarily, see Go. 2. Rust doesn't have memory management like in C. In Rust, abstractions and the compiler manage memory for you, except when you opt into C-like memory management using unsafe. 3. The comment was about memory safety, not memory management, and its benefit. 4. In case of GC vs manual memory management was used as a speed comparison: You might not REALLY need the speed of Rust, but I gladly take it where I can. I am tired of sluggish resource hogging electron apps and similar. Electron probably destroyed at least 10-15 years of progress in hardware performance gains.