News for hackers. Stuff that matters.
Re:Zig in 30 Minutes by AnIdiotOnTheNet on Sunday January 03, 2021 @10:15AM (#25622189)
Anonymous struct/tuple/array is a convenience feature that can only be used for values.

Consider the above code without it:

  std.debug.print("hello world!\n", struct{}{});
Now add a value:

  std.debug.print("{}!\n", struct{string: []const u8}{ .string = "hello world"});
Quite unwieldy. Zig used to have variadic functions and it was difficult to work with, complicated metaprogramming, and made how things work less obvious during reading. It was also pretty much only ever used for the "print" function.

There are no comments on this comment yet.