4 ms·
This isn't true at all IME. Rust's paradigms are great a lot of the time, but the best C++ code does not necessarily look like Rust code in all situations. The
by verdagon 5y ago
This isn't true at all IME. Rust's paradigms are great a lot of the time, but the best C++ code does not necessarily look like Rust code in all situations.
There are a lot of patterns in modern C++ which the borrow checker rejects, for example the observer pattern and dependency injection (the pattern, not the frameworks), which are often the best tool for the situation.
Also, are you saying that the C++ Core Guidelines encourage us to make code more Rust-like? I would love to read up on that, if you have a source.
- pjmlp 5y agoHere, http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
- verdagon 5y agoThanks for the link. I don't see any occurrences of "Rust" in this document...
- pjmlp 5y agohttps://devblogs.microsoft.com/cppblog/new-safety-rules-in-c-core-check/ https://devblogs.microsoft.com/cppblog/new-safety-rules-in-c... Better like this?
- verdagon 5y agoThanks! This article makes some nice recommendations, but they don't have much to do with Rust, these things have been in a lot of other mainstream languages for a long time. I'm not sure this supports zozbot's claim that the modern trend is to "refactor C++ code so that it's more Rust-like" very strongly. I also assume they meant that that we should adhere to AxM in C++ (since that's the only thing new Rust brings), to make interop with Rust easier, but I could be interpreting incorrectly.