Re:Using Rust at a startup: A cautionary tale
by lolinder on Saturday December 03, 2022 @12:31PM
(#33845254)
True, but linearity/affine types applied carefully in the context of a managed runtime would look quite different from Rust's borrow checker. The reason why Rust's borrow checker is so infamous is because Rust has to prove everything at compile time. Bringing affine types to a GC language would most likely involve making them opt-in (or only triggered in concurrent situations), while making linearity optional in Rust would undermine its foundations.
[ Parent
| on HN ]
Re:Using Rust at a startup: A cautionary tale
by zozbot234 on Saturday December 03, 2022 @12:38PM
(#33845317)
You can opt into runtime checking in Rust via interior mutability. Cell<>, RefCell<>, Rc<>, Arc<>, Mutex<>, Rwlock<> are constructs that involve varying levels of runtime checking. Most of these are way more efficient than GC. It's even simpler to use .clone() in order to effectively do away with any requirement for linearity.
Re:Using Rust at a startup: A cautionary tale
by steveklabnik on Saturday December 03, 2022 @05:53PM
(#33848335)
(Cell<T> doesn’t actually do runtime checking)