1. 12
  1.  

  2. 3

    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.

    1. 3

      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.

    2. 2

      Pretty much how I implemented BARE messages in Zig.

      1. 2

        BARE looks really interesting, thank you for sharing!