3 ms·
You have to manually optimize away unnecessary reference counting without help from the compiler.
by fauigerzigerk 10y ago
You have to manually optimize away unnecessary reference counting without help from the compiler.
- mikeash 10y agoThat is true, but a totally different issue from breaking or avoiding retain cycles.
- pcwalton 10y agoI have never seen unnecessary reference counting be a problem in Rust. That's because not manipulating the reference count requires an explicit action—.clone()—and borrowing is so expressive that you rarely need to manipulate the counts.
- fauigerzigerk 10y agoI guess that's because in Rust you never need defensive reference counting thanks to the borrow checker.
- Rusky 10y agoRust's borrow checker actually helps with this a lot- you can hand out references to the Rc-ed data without modifying the count, and the compiler will enforce that the count is not decremented until the references are dead. Combined with the fact that plain references are more idiomatic than Rc/Arc, this leads to pretty similar results.