4 ms·
> Rust still needs a way out of that mess. In practice, it really doesn't. The difficulty of implementing doubly linked lists has not stopped people from prod
by School-Cotton 1y ago
> Rust still needs a way out of that mess.
In practice, it really doesn't. The difficulty of implementing doubly linked lists has not stopped people from productively writing millions of lines of Rust in the real world. Most programmers spend less than 0.1% of their time reimplementing linked data structures; rust is pretty useful for the other 99.9%.
- Animats 1y agoDoubly linked lists are rare, but backlinks to the owner are often needed. It's the same problem, mostly.
- mplanchard 1y agoBacklinks work fine with weak Arc references, don’t they?
- Animats 1y agoYes. But the Arc has to wrap a Mutex, which means you have to lock to get access. It's a dual of the Rc/RefCell/borrow mechanism. The trouble with calling .lock() is that there is a potential for deadlock. There are some people working on static analysis for deadlock prevention, which is a dual of the static analysis for double borrow protection problem. We're maybe a PhD thesis or two from a solution. Here's some current research, out of Shanghai.[1] Outlines the theory, but code does not yet seem to be available. [1] https://arxiv.org/pdf/2401.01114 https://arxiv.org/pdf/2401.01114