This is exactly the kind of thing that I’ve wished C had for years – Lisp-like macros but with a compiled language. I know a number of recent languages have similar abilities, but this is an excellent demonstration of why such a feature is so powerful with a compiled language.
I know a number of recent languages have similar abilities
Yeah Zig definitely isn’t unique in compile-time programming capabilities, but I think Zig’s comptime is particularly elegant. I gravitated to C for a long time (despite its many flaws) because the language itself is so simple. Comptime really does strike a good balance between keeping the language small, and adding some metaprogramming power without going overboard.
This is exactly the kind of thing that I’ve wished C had for years – Lisp-like macros but with a compiled language. I know a number of recent languages have similar abilities, but this is an excellent demonstration of why such a feature is so powerful with a compiled language.
Yeah Zig definitely isn’t unique in compile-time programming capabilities, but I think Zig’s comptime is particularly elegant. I gravitated to C for a long time (despite its many flaws) because the language itself is so simple. Comptime really does strike a good balance between keeping the language small, and adding some metaprogramming power without going overboard.
Pretty much how I implemented BARE messages in Zig.
BARE looks really interesting, thank you for sharing!