What's your favorite Zig features?

My choices are:

  1. C interoperation;
  2. async;
  3. comptime.

And what I do not like: the @ prefix.

1 Like

What I like most

  1. Comptime.
  2. Simplicity, no hidden flows, especially the Allocator pattern.
  3. The std lib (design and cross-platform capabilities)

What I do not like:

No private fields … In C structs are meant to just hold fields, so there is no point in private fields there. But in Zig, you can express richer interfaces based on structs, and the only thing I can do to assure the correct usage of my API is writing “Don’t change it directly” in the field’s documentation.

PS: Maybe it is duplicated of Annoying things?

  • Types as first class citizens
  • for, while, if, and switch as expressions
  • Integers of any size
  • Effortless testing builtin
  • Effortless generics builtin
  • Effortless compile time evaluation builtin
  • errdefer is a brilliant idea
  • Manual memory management with flexible allocator options, combined with defer and errdefer feels natural
  • Powerful build system included
  • for, while, if, and switch as expressions

I would like to add: {} blocks as expressions.