| 1. Hard to count. Started as a youth on game modding, but in terms of serious projects, probably 5-7 years. 2. Rust. It's a Rust shop, and the only C++ we have is in dependencies that we wrap with Rust interfaces. 3. Rust. I've probably shaved a not-inconsiderable amount of time off my life in debugging C++ issues at both compile-time and runtime (inscrutable behaviours, memory safety, broken / unstandardized tooling, platform-specific nonsense, template metaprogramming sins that I've had to debug and - worse - add to, and much more) 4. Hmm. Template specialisation and more constant-time evaluation, I think. There's probably a few others, but that's what comes to mind. 5. Uh. Pretty much everything? - Consistent tooling that works across all platforms (I will be happy if I never have to look at a line of CMake ever again) - Built-in dependency management - A robust engineering culture (your code should account for failure!) - Consistency of code itself, made possible through rustfmt and clippy - Generics that surface issues at point of definition and not at point of instantiation - ADTs - Reduced reliance on human strictness / "getting it right" to, well, get it right. This isn't just the borrow checker - most APIs in Rust are designed to make using them wrong difficult. Even things like `Mutex<T>`, which combines a mutex and value, to make sure you can't access the value without locking, and you can't lock without knowing what you're locking. - Easy multithreading through invariants that the compiler tracks (the Send+Sync traits); they're not perfect, but there's nothing like the first time you change an `iter` to Rayon's `par_iter` and your code is magically eight times faster. - A value-based typed rich error handling scheme, so that you can see what errors a given piece of code might produce and be able to handle and propagate them with little fuss. (Similar to checked exceptions, but much more convenient! Adding some context to an error is a function call and `?` away, not a per-statement try-catch-rethrow). --- Honestly, I could keep going for a while, but my general point is that Rust has had the ability to learn from its predecessors, and it shows. Many of the mistakes, bad ideas, or poorly-fitting features of past languages just aren't present in Rust because the language was deliberately designed to avoid them. It's not a perfect language by any means - async Rust is the first and most obvious pain point - but it solves my problems in a much more ergonomic - and dare I say it, more fun - way than C++ ever did. |
C++ is already a very complex beast as it is.
ADTs (and pattern matching) make it concise to express many different programming things.
But I'd imagine that adding it to C++ would be horrendous.