5 ms·
YAML is better suited for configuration files.
by ishbits 14y ago
YAML is better suited for configuration files.
- joe_the_user 14y agoYaml is not good for configuration files because it is not easily human-editable. It seems "easy" but meaningful whitespace is a cluster-fck. Edit: I have been looking for reasonable configuration file formats for a while. Json actually has pretty bad human-readability at any scale because of its quoted key-values. Yaml is easily readable but when a user tries to change anything, things go to hell. The humble ini-file has won so far. It's limited and not fully standardized but it is human readable and human writable. I'd love see something better but human readability/writable is going trump all sorts of cleverness. Edit2: From http://en.wikipedia.org/wiki/YAML http://en.wikipedia.org/wiki/YAML "The specific number of spaces in the indentation is unimportant as long as parallel elements have the same left justification and the hierarchically nested elements are indented further." Yeah, a user of your software is going to be able to understand when they mess up on that rule, riiiight. Screw Yaml.
- chipsy 14y agoI rolled my own format specifically for configuration. No significant whitespace, delimiters may dangle, and the parser implementation can be configured to accept very high ambiguity(including, if desired, mixtures of sequence and key-value data). https://github.com/triplefox/triad/blob/master/dev/com/ludamix/triad/format/TriadConfig.hx https://github.com/triplefox/triad/blob/master/dev/com/ludam... A "real-world" example https://github.com/triplefox/triad/blob/master/examples/Assets/graphics.tc https://github.com/triplefox/triad/blob/master/examples/Asse...
- jscn 14y agoIt seems "easy" but meaningful whitespace is a cluster-fck. Tell that to everyone using Python. If your editor can't handle meaningful whitespace transparently, it sounds like you need a better editor.
- sigzero 14y agoPython is a programming language. Worlds of difference there.
- joe_the_user 14y agoyou need a better editor I think you misunderstand the concept of "configuration file". These are not intended for programmers but for users of the program you write. White complaints about Pythons' meaningful white are still common, programmers can get over that by, indeed, getting a better editor or otherwise wrapping their head around the situation. But end-users can't be expected to have this kind of sophistication. Explaining to someone while things they can't see have made their program usable is no fun.
- jpravetz 14y agoI wish there existed a popular config format that was somewhere between YAML and JSON. In my current nodejs project I sometimes use js files for config because js supports comments and is more lenient on syntax then JSON. I prefer using { } to group objects, rather then YAML indenting, but otherwise am okay with YAML and only don't use it because the parser is not part of Javascript or nodejs.