3 ms·
How is an interpreter expressed in Rust- what parts can be safe and what must be unsafe? For example the GC conceptually has access to every object at every all
by ridiculous_fish 5y ago
How is an interpreter expressed in Rust- what parts can be safe and what must be unsafe? For example the GC conceptually has access to every object at every allocation point, how does that work with the borrow checker?
- brundolf 5y agoReference counting and/or memory arenas and/or selective use of unsafe { }, depending on your goals This post provided a great deep-dive anecdote on just that: https://news.ycombinator.com/item?id=28026562 https://news.ycombinator.com/item?id=28026562
- steveklabnik 5y agoDepends on the details. If you are just doing a classic AST interpreter, no particular focus on speed, there's no need for unsafe code at all, especially if you do what Python does and just use refcounting, though I have not implemented a cycle detector personally...