News for hackers. Stuff that matters.
Re:The Magic of Partial Evaluation by infogulch on Wednesday November 18, 2026 @03:31PM (#50551733)
Doesn't Zig have a pretty nice implementation of compile-time evaluation built in?
Re:The Magic of Partial Evaluation by jimmyhmiller on Wednesday November 18, 2026 @04:09PM (#50552150)
Comptime in zig is definitely quite cool, but not quite the same.

Consider this example. https://jimmyhmiller.com/split-shot/#/vm

Make the code a comptime argument in zig and you get "store to comptime variable depends on runtime condition".

Re:The Magic of Partial Evaluation by hansvm on Wednesday November 18, 2026 @04:45PM (#50552568)
Zig isn't perfect, but I've definitely done this futamura stuff before. It's one of my favourite ways to implement a Forth in Zig (which, incidentally, is the default way that I introduce a backprop library or other DSL as I'm prototyping an idea). Interpreters are dead-simple to write, and I just write an interpreter with a comptime code argument. It definitely works, and the codegen is reasoanble out of the box.
Re:The Magic of Partial Evaluation by speedster217 on Wednesday November 18, 2026 @06:02PM (#50553599)
Thanks for the input! I was thinking about trying this out in Zig. The whole article reminded me of why I was originally excited about comptime