Hacker News new | ask | show | jobs
by gpm 1597 days ago
RefCell is distinct from Cell, more common, but much worse tradeoffs for implicit access, because accessing it can crash your program.
1 comments

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.