4 ms·
There are some similarities, like the module system, and the "self" convention for methods which in Rust is a keyword. At some point the similarities with Pyth
by 29athrowaway 4y ago
There are some similarities, like the module system, and the "self" convention for methods which in Rust is a keyword.
At some point the similarities with Python stop and the similarities with C++ start. Although without the sins of C++ (like decades of backwards compatibility going back to plain C), which greatly reduces the decision fatigue you get as a C++ developer.
Unlike C++, Rust can be learned. I maintain that nobody truly knows C++. There will be always C++ code that cannot be explained by an expert. Everyone learns a dialect of C++ that they feel comfortable with, but the entire space of what's possible within C++ and the implications of each feature at compile-time and run-time became too complex to be learned.
- lordgroff 4y agoI hear this often, and I get it, it's sort of true. And it's also false. While the entirety of C++ is impossible to learn, it took me SIGNIFICANTLY less effort to get a grasp of C++ to the point where I could do everything I needed to do with it. Sure, we can call that a dialect, but it's enough. Rust is an ongoing effort, because you need a lot more of the language as a whole to click before you get to the point where the compiler stops slapping you about elementary things. Now, if I was designing an application where memory safety and security was very important, I'd probably try and step up that rust knowledge. But in my field (data science) that's just not a big concern and I can code up a C++ solution MUCH faster than I ever could in Rust.
- tialaramex 4y agoOne surprise perhaps is that both Python and C++ have multiple inheritance whereas Rust doesn't have implementation inheritance at all (Rust's traits can inherit but data structures and implementations cannot). Both C++ and Rust have similar Quiz sites: https://dtolnay.github.io/rust-quiz/ https://dtolnay.github.io/rust-quiz/ https://cppquiz.org/ https://cppquiz.org/ You'll notice immediately that the Rust questions aren't trivial - this language does have some opportunities for confusion and weird ways to write things that surprise you and the quiz explores some things you'd probably never do and shouldn't do and their consequences are not obvious. But on the other hand you will quickly also realise that while "That's Undefined Behaviour" could be the correct answer in C++ (it's the correct answer for several of the default questions) it's never going to be the right answer in (safe) Rust by definition.