by bluejekyll · 4y ago · 0 comments
The great thing about Rust is that it reduces the knowledge and skill a developer needs in order to write a stable and (usually) performant program. This is a good thing.
Programs on the other hand can be written in entirely safe Rust, and the vast majority of Rust developers never need to use unsafe Rust to do this.
In Rust, we try to isolate unsafe usage and test it excessively. In C++ you have no such option.
And non-tree-shaped object graphs are not a library concern, but permeate entire applications; if you want to rewrite an app using shared mutability in Rust, you must either write code awkwardly with Cell/RefCell (and RefCell has runtime overhead), restructure the whole program in one Big Rewrite, or fallback to unsafe accesses (at this point, outside of multithreading C++ is a better Unsafe Rust than Unsafe Rust).
Please respond with a factual rebuttal before downvoting.
Repo: https://github.com/bluss/indexmap
IndexMap type itself: https://docs.rs/indexmap/latest/indexmap/map/struct.IndexMap...
It has amortized O(1) reads and writes, and it supports removal without maintaining order in O(1), or while maintaining order in O(n).
Sticking with Java, Rust also offers a better story around thread safety, such that sharing mutable state across threads requires types that allow that to work.
Finally, Java’s exception handling and null usage generally allows a lot of low hanging fruit bugs to slip through where in Rust these types of errors are far less likely to happen.
I never said Rust is “bug free”, I’ve been working with software far to long to make such a provably wrong statement.