2 ms·
The existence of features like Box::leak() doesn't compromise Rust's memory safety which is why that's not marked unsafe. The reference counted and garbage coll
by tialaramex 4y ago
The existence of features like Box::leak() doesn't compromise Rust's memory safety which is why that's not marked unsafe. The reference counted and garbage collected languages likewise can leak, and if Box::leak() didn't exist, people would just roll their own by the same means.
It's not even as though their hand-rolled mechanism would be syntactically heavier, you can't thing.leak() because leak intentionally isn't a method, it's just an associated function on Box and so you will need to explicitly Box::leak(thing)
I don't think Hare's design is at all conducive to trying to retrofit a borrow checker, and so I would agree with you that it should not attempt such a thing.
- lifthrasiir 4y agoI mean, the memory safety is not an exactly defined term and it took a compromise to pick the exact definition of memory safety for Rust. I fully agree that the memory leak is far less risky than this notion of memory safety, but it is still a (slight) compromise especially when you are new to Rust. As a new language Hare doesn't have to take this granted.