News for hackers. Stuff that matters.
Re:How Our Rust-to-Zig Rewrite Is Going by Joker_vD on Thursday July 16, 2026 @03:53PM (#48939422)
> Usually this would be done via an interpreter, so I'm not sure that it really requires unsafe either.

Well, I've personally have written a const-expression evaluator that actually reuses the rest of the compiler: it compiles the expression in the current environment with some specific adjustments to the codegen settings, launches the temporary executable and gathers its output... frankly, it's more hassle than it's worth compared to writing a separate const-expression interpreter. Plus, of course, it also runs slower since most constant expressions are usually pretty trivial.

Re:How Our Rust-to-Zig Rewrite Is Going by jibal on Saturday July 18, 2026 @08:12AM (#48957391)
It depends somewhat on the complexity of the language.

Nim uses an interpreter but Nimony, which is destined to becomes Nim 3.0, uses your approach. It will be interesting to how hassles and performance play out there and whether they keep the compile-and-run approach or go back to an interpreter.