4 ms·
The Value Types proposed in TFA are immutable so no need to have a borrow checker for them :)
by _old_dude_ 9y ago
The Value Types proposed in TFA are immutable so no need to have a borrow checker for them :)
- clhodapp 9y agoYou wouldn't need such a sophisticated tracker as Rust has because the implementation here rules out mutable borrows but you'd still need something that looked like ownership tracking or something that looked like garbage collection to correctly implement finalizers on value classes in the face of closure, right? When you close over a stack-allocated immutable value, the low-level effect is that you make a copy of it onto the heap, I'd think. However, at higher-level, you create another reference whose lifespan staves off finalization, no? Edit: I'll add that it's possible that the proper implementation for even a bog-standard, assign-to-a-variable copying would need to work this way (make another finalization-delaying handle) but I think that's less-certainly true.