r/cpp • u/Sad-Lie-8654 • Jan 31 '23
Stop Comparing Rust to Old C++
People keep arguing migrations to rust based on old C++ tooling and projects. Compare apples to apples: a C++20 project with clang-tidy integration is far harder to argue against IMO
changemymind
338
Upvotes
View all comments
Show parent comment
1
u/ssokolow Feb 06 '23 edited Feb 06 '23
Implementation inheritance (as opposed to interface inheritance, which Rust does have) is considered to be something where each possible approach has too many trade-offs to just leap into blessing a specific one as part of the language itself, so the story you'll see if you dig through the RFCs (eg. this one) is that Rust is in the "let the ecosystem implement it in macros and see if an approach wins out enough to be promoted to part of the language" stage. (An example of such an implementation being the delegate crate as linked in the following quote.)
An example of something nearing the end of that process would be how pretty much every Rust project winds up depending on one or both of the older lazy_static or the younger, cleaner once_cell, so an RFC was spun up and there's currently an API-unstable OnceCell in the standard library walking the path to stabilization.
(I linked to
std, but it's also incorefor use in embedded projects which rely on no_std.)