Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"But if the compiler can verify that a value is used exactly once, then why can't it verify that a value is destructed? We mark a function as a destructor and the compiler verifies that the value is passed to a destructor exactly once."

Even when you could verify this, it wouldn't prevent use after free bugs.



UAF are solved by an affine type system (like Rust has), they don't require a linear type system.

That is, an implicitly invoked destructor is not an UAF concern.


Agreed. To be clear, I'm not explaining why the OP chose linear types over affine types (I have mixed feelings on choosing one or the other) but rather why one needs either affine or linear types rather than "disposed exactly once" types.


Thank you--yes, that makes sense.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: