Discussion about this post

User's avatar
liate's avatar

Generational references are great! (I especially like that they're a pretty close reification of temporal memory safety: pointer/allocation + generation number vs pointer/allocation + abstract allocation id!) However, I think you missed their largest downside: unlike the more mainstream tools for guaranteeing temporal memory safety, they don't guarantee that live references are valid — they guarantee safety, but not liveness! Tracing GC'd and RC'd systems guarantee liveness trivially by construction, and substructural types and borrow checking more complicatedly guarantee liveness through type-system-like tools; generational references guarantee no use-after-free by just making all dereferencing fallible.

Again, generational references are cool, and enforcing memory safety with assertion-shaped things should be fine for anyone who uses runtime bounds-checked arrays over dependently-typed arrays or techniques like https://okmij.org/ftp/Computation/lightweight-static-guarantees.html . This is just the major thing to keep in mind when considering them, in a world where the established alternatives can't fail in valid programs.

Expand full comment
1 more comment...

No posts