News for hackers. Stuff that matters.
Re:How I Built Zig-SQLite by kzrdude on Friday May 27, 2022 @03:39PM (#31533946)
I'm wondering what the point of the period is here, could it be done without it?
Re:How I Built Zig-SQLite by throwawaymaths on Friday May 27, 2022 @08:32PM (#31536487)
I think it allows the parser to be context-free since otherwise it is tricky to distinguish it from a code block. They could have picked a different sigil, but I think . was landed on because it had the fewest semantic conflicts with other concepts in the language (for example % is used to denote modular arithmetic)
Re:How I Built Zig-SQLite by alpaca128 on Friday May 27, 2022 @04:14PM (#31534364)
I don't know why, but this is a part of the language's syntax, for example when matching a union type each named variant also has that period. Same with the argument for print statements (`print("{s}", .{var})`).
Re:How I Built Zig-SQLite by kzrdude on Friday May 27, 2022 @04:21PM (#31534442)
aha, seems like they use the list argument to print instead of having varargs functions then?
Re:How I Built Zig-SQLite by bo0O0od on Friday May 27, 2022 @10:32PM (#31537097)
In zig code blocks are expressions and can appear in a lot of places, e.g. on the RHS of an assignment. Probably possible to not need the dot but considerably more complicated.