(World
(Asia
(China 1409517397)
(India 1339180127)
(Indonesia 263991379)))
With an editor that supports Paredit or Parinfer, it's impossible to create an invalid tree, because you manipulate the structure of the tree (nodes and leaves) instead of manipulating error-prone text.Have you heard of org-export-json? [1]
Have you heard of json.el? [2]
[1] https://github.com/mattduck/org-toggl-py/blob/master/org-exp...
root
parent
foo: 1
bar: 1
Syntax details might be off from the top of my head, but the example in the tweet is a bit overblown.I will say it might be easier to write. do string quoting, quote escaping and newline embedded in a quoted string work?
However, the implied question here is absolutely valid: Why write your own flat-file format parser from scratch, when there's a multitude of battle-tested third-party libraries already in existence?
I mean, if you're writing something very specialized or proprietary, that's one thing. But if you're simply proposing a generalized tree shape that looks like YAML, then why not indeed use YAML? I know it's tricky to write a YAML parser... but so what, why would you? There are already a ton of great ones.
1. intermediate steps in YAML are often invalid documents (breaks the update on every key press)
2. you have to be trained to write YAML. It is quite easy to make a syntax mistake with YAML if you aren’t used to writing it. Not good for an interactive experience
<World>
<Asia>
<China>1409517397</China>
<India>1339180127</India>
<Indonesia>263991379</Indonesia>
</Asia>
</World>That said, the statement itself came off really snarky.
{World
{Asia
{China '1409517397'}
{India '1339180127'}
{Indonesia '263991379'}
}
}