3 ms·
Funnily enough, I've been working on solving the same problem concurrently. Though in my _very_ biased opinion; I think CONL is easier to read and write: https
by cirwin 2y ago
Funnily enough, I've been working on solving the same problem concurrently. Though in my _very_ biased opinion; I think CONL is easier to read and write:
https://github.com/ConradIrwin/conl https://github.com/ConradIrwin/conl
value = example
map
a = b
list
= 1
= 2
multiline_value = """bash
#!/usr/bin/bash
echo "hello world"
- lifthrasiir 2y agoAgreed that this is much better than the OP. That said, my general opinion is that a whitespace-only indentation should be avoided especially in the serialization format due to the inherent ambiguity of whitespace characters and resulting human mistakes. When I designed CSON [1] I strived to make it as readable as possible without the indentation for that reason. [1] https://github.com/lifthrasiir/cson https://github.com/lifthrasiir/cson
- cirwin 2y agoNice – I like your verbatim syntax for multiline strings! I went with indentation because a very common use-case in a configuration file is commenting out lines. Even with CSON-like comma rules, you still need to balance your {} and []s. Indentation balances itself most* of the time.
- lifthrasiir 2y agoIndentations are still desired for most human tasks indeed! But you can have indentations and groupings at once, one complementing each other. As you've noticed, CSON's verbatim syntax was intentionally designed so that it remains valid without any indentation but your instinct really wants to align those lines anyway. (A similar approach can be seen in Zig verbatim strings, which seem to be designed independently from CSON and make me much more confident about this choice.)
- GeneThomas 2y agoIndentation in xᴇɴᴏɴ is optional and for readability.
- GeneThomas 2y agoI mean it can be encoded inline, including using \n in strings