Hacker News new | ask | show | jobs
by pjmlp 1597 days ago
Unless GUI code comes up with Rc<RefCell<>> all over the place.
1 comments

RefCell is distinct from Cell, more common, but much worse tradeoffs for implicit access, because accessing it can crash your program.
I want Cell to be more ergonomic because it addresses the same Rust weak points as RefCell but without runtime overhead and panicking. I think RefCell<struct> should be an infrequently used type that you reach for when you specifically want to guard against reentrancy, and struct{Cell} should be the primary replacement for shared access in other languages. The latter is sound but introduces a lot of boilerplate syntax.