Re:Show HN: Tiny 1k Rust binary on Windows
by mcountryman on Wednesday December 02, 2020 @06:31PM
(#25283266)
I'm a little short on time so I didn't read through all of it but, comptime generics sounds similar to how rust compiles generics and comptime parameters are similar to const fns although zig appears to have more control over what is deamed "compile time".
https://ziglang.org/documentation/master/#comptime
See an example calling firstNPrimes. "When we compile this program, Zig generates the constants with the answer pre-computed." "Note that we did not have to do anything special with the syntax of these functions. For example, we could call the sum function as is with a slice of numbers whose length and values were only known at run-time."
Then see "Case Study: printf in Zig"