3 ms·
This is a really good analysis, and it points to a central flaw in Rust. As a practical matter, you have to have more than one pointer to a data structure all t
by ccleve 3y ago
This is a really good analysis, and it points to a central flaw in Rust. As a practical matter, you have to have more than one pointer to a data structure all the time. You really can't implement some things without it.
Rust makes this really, really difficult. If you can live with immutable pointers, you can have as many as you like, but the lifetime syntax you have to juggle can become a horror show, and can force lifetime annotations on a whole chain of structures. If you can't live with immutable references, then you are forced to use the unnecessarily ugly Rc<> syntax.
I often find myself using the array indexes trick, which leads to buggy code.
In Java, I never had to do this. Multiple "pointers" are fine. The garbage collector takes care of memory safety. In this one sense, Rust is a less-safe language than Java.
I have been writing Rust for two years now. I would not use it again if I could avoid it. It is a giant waste of time.