3 ms·
My point wasn't actually that Rust's ownership model could be improved. While that's also true, features like being able to take disjoint mutable borrows of two
by samatman 2y ago
My point wasn't actually that Rust's ownership model could be improved. While that's also true, features like being able to take disjoint mutable borrows of two fields of a struct are generally agreed to be good things to have, and I expect the language team to solve them eventually.
It's simpler than that: Rust prevents you from doing a lot of correct things in the safe subset of the language. It does it for a good reason, because that lets the compiler prove a bunch of nice properties, but it's a fundamental tradeoff: in exchange for not having to deal with bugs in shared mutable access to data, it doesn't let you write programs that way. I actually think that Rust is a great choice for multithreaded programs which want to follow a one-writer-many-readers pattern, because that's very difficult to do correctly without the borrow checker.
But when you say this:
> The ownership problems are 100% there in other languages too, it just isn't a compiler error.
A straightforward read of that is that anything you can't do in safe Rust is a bug. That's very far from true, it's in fact backward: what you can do in safe Rust isn't an ownership bug, by construction. But I see this implication reversed in a lot of Rust advocacy, and it directly contributes to the Rust fatigue which you'll see on this very website, and many other places.
It's the difference between prohibiting potentially unsound ownership policies (what Rust does) and prohibiting only unsound ownership policies (which safe Rust does not).
> My main point is, the general concept of ownership and having to care about it is present everywhere
I completely agree with this, fwiw.