3 ms·
this has two of my favorite features! 1. comments aren't part of the parse tree, so I can quickly strip all comments by a quick parse print cycle. This is real
by jfoutz 6y ago
this has two of my favorite features!
1. comments aren't part of the parse tree, so I can quickly strip all comments by a quick parse print cycle. This is really helpful if you want to do automate changes to the files.
2. I can freely truncate the file at (almost) any point, and still have a valid config file. It's not obvious up front, but if your file gets snipped at some point, it's won't cause parse errors (usually) consumers of the file.
- bowmessage 6y agoCould be missing the start of the file too, in rarer cases. Wonder what the best start of file and EOF-equivalent sentinel would be to use for YAML-esque files. Something like a double colon? :: item1: - etc.. ::
- makapuf 6y ago2. Add someone says in another comment, isn't that a mistake? What if my file is accidentally cut? In which cases would I want to snip my file without editing it?
- epalm 6y agoRegarding #2, would you really be ok with loading half a configuration file? Or am I misunderstanding your point?
- jfoutz 6y agoThe parent comment is irony. I've been wrestling with some declarative configuration, and it's getting to that frustrating scale where things are almost the same but a little different. 2. isn't too bad in yaml, since json is valid yaml, a broken file can be reliably picked up with leading '{' and trailing '}' With regard to 1 - both comments and nonstandard formatting like the above {} hack, are currently hard. Anyway, got to spend some time outside, and away from screens. Apologies for the snark.