3 ms·
Writing multi-line strings in Zig is not easy.
by 127 4y ago
Writing multi-line strings in Zig is not easy.
- kristoff_it 4y agoI really don't understand why people have issues with Zig's multiline syntax. \\I really don't \\understand why people \\have issues with \\Zig's multiline syntax
- lostmsu 4y agoI never used Zig, but used many other languages, and that looks better than most which don't have line prefix like \\: in languages that don't need it there is confusion about significance of whitespace in the beginning of 2nd+ lines.
- kristoff_it 4y agoYep, that's precisely what that sintax solves, and also makes it easier to build a grammar for it (think of editor syntax highlighting for example) because the multiline marker is repeated in every line, instead of being a contextual marker. This is the same reason why Zig doesn't have dedicated multiline comment syntax.
- 127 4y ago- Can't easily indent - Can't easily copy paste - Can't easily edit - Looks ugly - Harder to read
- vkazanov 4y agoHuh? It might be slightly wordy, but otherwise very simple and easy for both people and computers to read. Even a primitive editor with primitive highlighting can make the syntax painless. Reasoning: https://github.com/ziglang/zig/issues/162 https://github.com/ziglang/zig/issues/162