One really nice use of this is printf. In C, printf needs a remarkably large amount of code and it’s quite slow. In zig, printf marks the format string as comptime. Then the compiler runs the code looping over and evaluating the format string, then unrolls the result into the binary. The output ends up being a few terse calls to write / format with no extra machinery at runtime. And you get clean compile errors if the format string doesn’t match your arguments - all with no special casing in the compiler.
More detail, with code: https://ziglang.org/documentation/master/#Case-Study-printf-...
I think nim has something similar.
I’m surprised rust went with macros instead of something like comptime - though I assume there’s some trade offs I’m not aware of.