Re:Crafting Interpreters with Rust: On Garbage Collection
by grumpyprole on Wednesday July 31, 2024 @01:07PM
(#41121002)
My minor nit pick is that it uses mostly the Java language to implement a Java-like language. What have we gained? Surely something Python-like in C would be more rewarding, one would be gaining a level of abstraction.
[ Parent
| on HN ]
Re:Crafting Interpreters with Rust: On Garbage Collection
by munificent on Wednesday July 31, 2024 @02:21PM
(#41121777)
> Surely something Python-like in C would be more rewarding, one would be gaining a level of abstraction.
That's the second half of the book.
Re:Crafting Interpreters with Rust: On Garbage Collection
by grumpyprole on Wednesday July 31, 2024 @03:30PM
(#41122585)
My apologies, that does indeed seem like a reasonable way of doing it.
Re:Crafting Interpreters with Rust: On Garbage Collection
by munificent on Wednesday July 31, 2024 @09:44PM
(#41125447)
Also, I should note that even in the first half of the book, the language isn't Java-like. It has Java-ish syntax, but the semantics are much closer to JavaScript/Python/Lua.
In the first half, what we gain from implementing it in Java is mostly the garbage collector. The rest of the static and runtime semantics basically have to be implemented from scratch on top of the JVM.
Re:Crafting Interpreters with Rust: On Garbage Collection
by grumpyprole on Thursday August 01, 2024 @02:50AM
(#41126731)
There is significance coverage of OOP features, hence my Java-like comment. I would have personally left OOP out for a beginner book, it isn't really fundamental. Another advantage to using Java in the first half, could be to use Java closures to implement Lox closures.
Re:Crafting Interpreters with Rust: On Garbage Collection
by munificent on Thursday August 01, 2024 @11:12AM
(#41130001)
> I would have personally left OOP out for a beginner book, it isn't really fundamental.
This was a deliberate choice. Most intro compiler/interpreter books don't do OOP. But most languages in wide use today are object oriented. That felt like a significant gap to me. One of the main goals with my book is to give people insight on how the languages they actually use work under the hood. Skipping objects and method dispatch would limit that.