3 ms·
I'm not wild about the new trend of languages of making a bunch of syntax dependent on a single small sigil. It gives me a strong feeling of Perl's historical
by akira2501 4y ago
I'm not wild about the new trend of languages of making a bunch of syntax dependent on a single small sigil. It gives me a strong feeling of Perl's historical "eclecticness" and I feel like I'm putting more effort into correctly reading the program back into my mind than I should ideally have to.
- kzrdude 4y agoI'm wondering what the point of the period is here, could it be done without it?
- alpaca128 4y agoI 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})`).
- kzrdude 4y agoaha, seems like they use the list argument to print instead of having varargs functions then?
- throwawaymaths 4y agoI 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)
- bo0O0od 4y agoIn 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.