Hacker News new | ask | show | jobs
by ekidd 946 days ago
> 1. How many years of C++ programming do you have under your belt? How many years of Rust?

12-15 years of C++, 8 years of Rust. I generally used C++ because it was the only tool that could do the job at the time, not because I actually liked it. At best, I had a love/hate relationship with C++.

> 2. For new work projects, do you choose C++ or Rust? Why?

Almost always Rust. The main reasons:

- Cargo is awesome, and the crate ecosystem is incredible.

- I barely trust myself to write rigorously correct C++, despite having plenty of C++ experience and being extremely paranoid about code correctness. And I defintely don't trust most other people to do it correctly. (I have maintained more than my fair share of other people's C++ code, and the average C++ code is buggy garbage.) C++ is like fishing around in a drawer of extremely sharp knives in a dark kitchen; you're going to get cut.

- I trust the average Python or TypeScript developer either to write correct Rust, or to be defeated by the borrow checker. This isn't just the borrow checker—it's also bounds checking on arrays and slices, the choice to panic instead of corrupting memory, the rareness of undefined behavior (and "nasal demons", and irresponsibly aggressive optimizations) in safe Rust, the safe mulithreading support, etc.

However, I would consider using C++ in domains where correctness and security weren't important, and where I wanted to use mature frameworks. Games would be an obvious case!

> 3. For new hobby projects, do you choose C++ or Rust? Why?

Rust. Way more fun, personally. :-) I tend to like using "functional" architectures, so I don't fight the borrow checker much.

> 4. Is there something about C++ that you wish Rust had?

Well, now that const generics are in, I'm pretty happy with Rust's feature set. But for quite a while that was the best C++ feature Rust was missing.