The thing is, getting rid of shared mutable state entirely is a huge paradigm shift. It means many libraries (GUI libs especially) can't be cleanly wrapped. It means throwing away common data structures like linked-lists. A C++ programmer can learn the syntax of rust is a week, but it may take years to get comfortable with the borrow checker.
I mean you could imagine a hypothetical future scenario where it is demonstrated that the optimizers are good enough to essentially eliminate the run-time cost of RefCell wrappers, and a lot of Rust programmers just start wrapping everything with RefCells by default.
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus#exclusive-w...
There is also `Cell` (https://doc.rust-lang.org/std/cell/struct.Cell.html), which offers a different set of tradeoffs.
> which policy do you want to be the zero-overhead default
The one where:
- The compiler can make more optimizations
- I'm less likely to shoot myself in the foot my conflicting mutations
is a good default for me, so I'm in favor of Rust.
> a hypothetical future scenario where it is demonstrated that the optimizers are good enough
This sounds like the sufficiently smart compiler (http://wiki.c2.com/?SufficientlySmartCompiler) argument. While I'd love to live in this world, we aren't there yet.
Even in such a world, there would still be reasons to choose Rust over C, such as standardized dependency management or a rich type system.
It does not require such; the Rust standard library even has a LinkedList (https://doc.rust-lang.org/std/collections/struct.LinkedList....).
> A C++ programmer [...] may take years to get comfortable with the borrow checker.
One of my earliest / biggest revelations when learning Rust went something like:
- Rust is stupid; I've been writing code like this in C for years, but Rust rejects it.
- ...time passes...
- Oh, I understand why Rust rejects this code now.
- OH MY GOD I'VE BEEN WRITING CODE LIKE THIS IN C FOR YEARS
A conceptual borrow checker is something that every C and C++ programmer should be running in their head for every line of code that involves references / pointers that they touch. I'm happy to let the automated algorithm provided by Rust do that for me instead.
These are still very difficult in Rust. I've heard pinning being stabilized makes them possible safely, but I haven't looked further.
[0]: At least, when I was starting Rust, this is what I would mean when I complained about linked lists.