5 ms·
Using pervasive sharing in Rust is not the easiest route even with a perfect GC, e.g. one is forced to use types like RefCell and Cell anywhere that mutability
by dbaupp 11y ago
Using pervasive sharing in Rust is not the easiest route even with a perfect GC, e.g. one is forced to use types like RefCell and Cell anywhere that mutability is required, adding syntactic overhead, more restrictions (especially around threading), slight runtime overhead (mainly for the former; Cell "just" inhibits aliasing-based optimisations, while RefCell does that and stores & manipulates some extra integers) and runtime panics instead of compiletime errors, for RefCell.
- vvanders 11y agoThat's the thing though, every place I've seen pervasive sharing could be replaced my explicit ownership(including a clean mechanism for transferring ownership). Being explicit about who owns something makes it much harder to leak things by forgetting to clear references/etc.
- deleted 11y ago[deleted]
- Rusky 11y agoGarbage collection, or something like it, is very useful when implementing lock-free data structures, which are very important in systems programming. Typically they get implemented using some kind of RCU (there was even a post about doing that in Rust, recently), but it's good to have options when you're tuning performance at that level.
- steveklabnik 11y agohttps://news.ycombinator.com/item?id=10131429 https://news.ycombinator.com/item?id=10131429 :)