Open exxjob opened 10 months ago
To clear up ambiguities:
\}
sequence) may be forbidden.
{
or delimiter) in-between spaces should be respected as formatting. Presumably this won't necessitate zig fmt changes. Visual underscore separators would be good for symmetry with number literals and highlighting Unicode planes and ranges. https://github.com/ziglang/zig/issues/17376#issuecomment-1745072369This proposal would also make it intuitive to handle Unicode grapheme clusters, ZWJ / VS15 / VS16 emojis, and other needs. Minutia can be changed around, but I think this is approximately the right way to go about it.
Is there precedence for \
meaning multiple elements?
I agree that it's an improvement, but just naively looking at this, I think simply delimiting elements via comma ,
(maybe which optional space after it) would look even more readable to me personally.
(I assume a parser already has to enter a special state to implement this, so I don't think giving special meaning to ,
in this context would affect performance much, if that was the reason.)
\\
denoting \
delimiting escape sequences within a string literal.,
being a character within a string literal.@rohlem it's more about not introducing regrettable ambiguities into string literals.
Preferring escape sequences to UTF-8 in source is a common coding standard, one reason being security. Directionalities, dingbats, emojis, diacritics, logograms, notations, controls... shouldn't or can't be printed in source files in many contexts. Currently, successive UTF-8 codepoints in escape sequences looks like so:
The proposal is to support multiple values in escape sequences with this syntax:
This is easier and safer to read and write. Backslash delimits at the end of a codepoint. Also applies for #17376 if accepted. See comment https://github.com/ziglang/zig/issues/17376#issuecomment-1745072369