by amelius · 1y ago · 0 comments
Rust is more related to ML-family languages than C-family and OOP, so it needs to "emulate" some C++ idioms.
This goes both ways, e.g. equivalent of Rust's pattern matching on enums with data translates to verbose and clunky C++.
This is more like: how to survive rustc as a cpp programmer which is honestly your mindframe when you start out, and it sets you up for "okay now that you speak the syntax, this is how to really think in rust terms".
class Person { int age = 0; };
I wish rust would make default struct field values this easy to write.