4 ms·
> If you miss a const in C++, no big deal. The program still works. It's mostly a safety net. [with notable exceptions] But if you forget a mut in Rust, the pro
by Buttons840 3y ago
> If you miss a const in C++, no big deal. The program still works. It's mostly a safety net. [with notable exceptions] But if you forget a mut in Rust, the program is not going to work.
I just can't take your argument seriously. One of your arguments is "the program will still work, with notable exceptions". I'm not persuaded.
You say it's a matter of preference, fair enough. I say let's make companies financially liable for the consequences of their preferences and see how this shakes out.
- Night_Thastus 3y agoEvery language, every rule, every suggestion has exceptions and gotchas. That's just life, and programming in general. I can't think of anything significant off-hand, it was just more to stave off this part from the post: >If you take a parameter by non-const reference, the caller can only use lvalues to call your function. But if you take a parameter by const reference, the caller can use lvalues or rvalues. So some functions, in order to be used in natural ways, must take their parameters by const reference. >I say let's make companies financially liable for the consequences of their preferences and see how this shakes out. This is completely unrelated. It's also a bit of a dangerous road to go down and I'd suggest thinking about it a lot more.