4 ms·
> Decent C and C++ developers shouldn't take that long to grasp the borrow-checker. Those that don't can't be trusted coding C or C++ in the first place. Becaus
by JoshTriplett 3y ago
> Decent C and C++ developers shouldn't take that long to grasp the borrow-checker. Those that don't can't be trusted coding C or C++ in the first place. Because they don't have a good enough mental model of memory management to deal with it manually.
In fairness to C and C++ developers: while often the problem is not understanding memory management, sometimes the problem is understanding it and having a model that doesn't mesh with borrow checking, or having a problem that needs some additional work to map into something easy to write in safe code. For instance, it takes some additional knowledge in Rust to know that if you want to build a graph, you 1) should almost always use an established graph library and not write your own, and 2) if you do need to write your own graph, you either need to use Rc, have an array of nodes and use indices, or use unsafe and raw pointers and provide a nice safe well-tested wrapper.
(I'm one of the developers of Rust, and I think it's important to characterize languages fairly.)
- carlmr 3y agoI don't disagree with either of your points, but when I learned Rust, those points about borrow-checker vs graphs in the cycle were entirely clear after looking at the first few tutorial lessons on the borrow-checker. Maybe day 2 of learning Rust for me. And coming from C++, Rc is not such a foreign concept compared to smart pointers. Coming from C it might be a bit more of a foreign concept I'll admit.
- deleted 3y ago[deleted]