Re:Ask HN: Why do you use Rust, when D is available?
by rational_indian on Saturday June 13, 2020 @06:23AM
(#23508415)
What architectural level capabilities?
Re:Ask HN: Why do you use Rust, when D is available?
by ncmncm on Saturday June 13, 2020 @05:50PM
(#23513081)
Template partial specialization, function template overloading, variadic template argument lists, template operator overloading, generic lambdas, the list goes on and on and on. Look up any list of C++20 language features; most are not in Rust. Look up any list of Standard Library components; most are not expressible in Rust.
Rust is going interesting places, is taking full advantage of starting from scratch, and is miles ahead of C, Java, and Go on every axis. But if Rust could get to where C++ was in 2011 by 2025, that would be amazing. Meanwhile, C++ has already shipped C++14, C++17, and C++20, will have done C++23, and will be firming up C++26.
Assume Rust could match C++20, just five years later, in 2030, which would be more amazing. C++29 will be out.
There are kludgy workarounds for everything, more or less, but why switch to a limited language with immature tooling and practically nonexistent immediate prospects, when C++ demand is going up, up, and up?
Memory safety is just not an issue at the level where coders of modern C++ work. I have had exactly one lifetime error in five years, caught in initial testing. My bugs are overwhelmingly specification omissions and logic mistakes that Rust suffers from exactly as much.
My day-to-day experience is to write 2000 lines and, when it compiles, it works correctly, modulo a "!" short or extra. Then, I spend a few days refining the design, which often means deleting code. Things Rust promises to help with consume only trivial attention. Library features not expressible in Rust prevent many more and bigger problems.
Rust has some nice qualities I would rather C++ had--pattern match support, simple iterators, default const and default pass-by-move, sane conversions, sane initialization--but they are all low-level conveniences, not anything I am willing to trade away architectura-level capabilities for.