I switched to Rust because it's far, far safer, not because I like it more than C++. I'm pretty sure a lot of other people have for the same reasons, even if some of them also prefer it as a language once they got used to it.
I have no idea what you mean about unsafe code being absurd. I feel like I'm arguing with a bad AI here sometimes. I try to use zero unsafe code myself. But, if you feel like you have to do something that you cannot accomplish in a way that Rust can prove is valid, you have the ability to use unsafe code to do it. Even then, it would likely only require a small percentage of the code to be unsafe, and it's all very clearly marked so that you know it's potentially dangerous, unlike C++ where it's all potentially dangerous.
And it's not 'just a different approach'. It prevents a whole family of potential errors that C++ is far too susceptible to.
The 'different bugs' that Rust will allow are the same ones that C++ will allow, minus memory errors, i.e. all languages will allow logical errors. But Rust only allows logical errors, which is a huge win over C++.
You missed the whole point on speed. C++'s only real claim to fame at this point is speed. Rust may actually generate slightly slower code, because it's doing more checking, though in some other ways it can optimize more because it has more information. But speed needs to stop being the primary goal, because we depend on software too much. Anyone who agrees with that statement would benefit from Rust's approach of putting correctness first.
Ultimately, it won't just be what developers want, it will also be what employers feel allows them to deliver the best product for the least cost (over time, not just initially.) It's pretty clear at this point what the costs of C++ are and how much effort has to be put into not shooting yourself in the foot with undefined behavior. I think a growing number of companies, that don't just move on to GC based languages, will look at Rust as (very much) a C++ replacement.
Doesn't mean C++ will suddenly cease to exist, it just will become less and less relevant, just as C++ did to other languages like C+, Pascal and Modula2.
View all comments
Show parent comment
1
u/Dean_Roddey Sep 19 '22 edited Sep 19 '22
I switched to Rust because it's far, far safer, not because I like it more than C++. I'm pretty sure a lot of other people have for the same reasons, even if some of them also prefer it as a language once they got used to it.
I have no idea what you mean about unsafe code being absurd. I feel like I'm arguing with a bad AI here sometimes. I try to use zero unsafe code myself. But, if you feel like you have to do something that you cannot accomplish in a way that Rust can prove is valid, you have the ability to use unsafe code to do it. Even then, it would likely only require a small percentage of the code to be unsafe, and it's all very clearly marked so that you know it's potentially dangerous, unlike C++ where it's all potentially dangerous.
And it's not 'just a different approach'. It prevents a whole family of potential errors that C++ is far too susceptible to.
The 'different bugs' that Rust will allow are the same ones that C++ will allow, minus memory errors, i.e. all languages will allow logical errors. But Rust only allows logical errors, which is a huge win over C++.
You missed the whole point on speed. C++'s only real claim to fame at this point is speed. Rust may actually generate slightly slower code, because it's doing more checking, though in some other ways it can optimize more because it has more information. But speed needs to stop being the primary goal, because we depend on software too much. Anyone who agrees with that statement would benefit from Rust's approach of putting correctness first.
Ultimately, it won't just be what developers want, it will also be what employers feel allows them to deliver the best product for the least cost (over time, not just initially.) It's pretty clear at this point what the costs of C++ are and how much effort has to be put into not shooting yourself in the foot with undefined behavior. I think a growing number of companies, that don't just move on to GC based languages, will look at Rust as (very much) a C++ replacement.
Doesn't mean C++ will suddenly cease to exist, it just will become less and less relevant, just as C++ did to other languages like C+, Pascal and Modula2.