3 ms·
Context: I write rust professionally I have no plan of coming back to cpp. Cpp still has the (huge) advantage of maturity. Rust is great but still half-backed.
by HippoBaro 4y ago
Context: I write rust professionally I have no plan of coming back to cpp.
Cpp still has the (huge) advantage of maturity. Rust is great but still half-backed. Things like thread-local-storage, custom allocators and async are either unstable or incredibly rough around the edges.
Finally, my experience has been that third-party libraries in cpp are fewer but of greater quality than the ones in rust. There are many many libraries available in rust due to the amazing dependency system. But the average quality is quite poor.
In cpp you tend to be conservative when adding dependencies which means you have a much better understanding of the code you run. Or, you write your own code that’s usually custom made for your purpose, which generally end up as being more performant.
- Jensson 4y ago> There are many many libraries available in rust due to the amazing dependency system. But the average quality is quite poor. The main problem with Rust is that it is thread safe, and that makes code and libraries very hard to write. Thread safety is a lot stricter than memory safety, and since it is easy to write single threaded memory safe modern C++ it gets hard to shift to Rust. But if you want thread safety or mostly do data processing scripts then Rust is far superior, just that for many applications enforced thread safety is an anti feature since it makes your code way too hard to work with. If they could make ergonomic thread safe libraries for everything then great, but I really doubt it will ever happen as it is very hard to do.
- surajrmal 4y agoThis is a common misconception. Not all rust code is thread safe. You can use and implement types like Rc which are !sync. What rust enforces by default is concurrency safety. For instance iterator invalidation is something which can occur on a single thread, but rust prevents it from occurring. Of course rust can enforce thread safety as well, but you're allowed to write code which is not thread safe. Contrast this with c++ where it's hard to know the context in which your code will be run so you may end up preemptively making it thread safe, like in the case of std::shared_ptr.