2 ms·
“Extra careful to cover all cases is when I start looking at alternatives.“ IMO, an advantage of C++ is that, in well-written code, being extra careful is (mos
by Someone 6y ago
“Extra careful to cover all cases is when I start looking at alternatives.“
IMO, an advantage of C++ is that, in well-written code, being extra careful is (mostly) limited to the implementer of code, not to its users.
It would be nice if nobody would have to be extra careful, but that’s the price you pay for power, I fear.
- pornel 6y agoRust shows that you can remove most of the footguns, and keep the power with a much smaller "extra careful" surface. For example, instead of a comma operator and its overloads, you can have tuples. Then `let (a,b) = (b,a)` works as expected. If you want weird code, you can overload `vec += (1,2,3,4,5)` with a tuple, and that's a straightforward case with no hidden gotchas.