Oh! No, you found another variation! ![]()
In print("{s}", .{}) the .{} means you’re declaring a tuple!
Oh! No, you found another variation! ![]()
In print("{s}", .{}) the .{} means you’re declaring a tuple!
That dot in .{ } doesn’t mean anything on its own, it’s just part of .{ and is not neally consistent with the other field/namespace access dots.
Just think of the whole .{…} as a special kind of braces used for tuples/struct literals, because normal {…} braces already mean other things.
(When anonymous struct literals were added in Zig 0.6.0, simply using { } (like in C) was not possible because that would have led to certain parse ambiguities, so the abominable .{ } syntax was invented as a hack, with the hope that the dot could be removed later, but unfortunately this has not happened yet, see get rid of the `.` in tuples & anonymous struct literal syntax · Issue #5039 · ziglang/zig · GitHub)
Thanks so much to everyone helping me try and understand this !