4 ms·
Even better than RAII would be linear types, but it would require a borrow checker to track the lifetimes of objects. Then you would get a compiler error if you
by xmorse 1y ago
Even better than RAII would be linear types, but it would require a borrow checker to track the lifetimes of objects. Then you would get a compiler error if you forget to call a .destroy() method
- throwawaymaths 1y agono you just need analysis with a dependent type system (which linear types are a subset of). it doesn't have to be in the compiler. there was a proof of concept here a few months ago: https://news.ycombinator.com/item?id=42923829 https://news.ycombinator.com/item?id=42923829 https://news.ycombinator.com/item?id=43199265 https://news.ycombinator.com/item?id=43199265