5 ms·
You are using YAML already. How much do you care about best practices. Only partially kidding here.
by jasonlotito 6y ago
You are using YAML already. How much do you care about best practices.
Only partially kidding here.
- EdwardDiego 6y agoYou're currently being downvoted, but I agree, YAML is kinda terrible, not sure why anyone thought Python's syntactically relevant whitespace was ideal for a config file. Classic example: - containerPort: 7173 name: http I think that's an object in a list? But it's not overly clear.And if I indented any of those lines wrong...
- corty 6y agoalso, keywords of the underlying software mechanisms are decoupled, so uncheckable for plain YAML tooling. Whereas with XML you can at least infer a lot about the desired structure and keywords from the schema. Deeper checks are only possible with "real" programming languages, preferrably statically typed ones. I'm wondering when that wisdom trickles down to configuration languages.
- dmitriid 6y agoDon't forget the plethora of truthy values that put Javascript to shame. - country: NO Of course it's boolean
- riffraff 6y agothat was changed in YAML 1.2[0], which I think is many years old, but people don't specify a version on config files anyway and I'm not even sure most parsers respect it, so it keeps popping up, which is sad. [0] https://yaml.org/spec/1.2/spec.html#id2803629 https://yaml.org/spec/1.2/spec.html#id2803629
- dmitriid 6y agoThat's the problem with bad formats: they live forever. They and any number of parsers for any version between version 0 and now.
- pydry 6y ago>not sure why anyone thought Python's syntactically relevant whitespace was ideal for a config file. Because it reduces syntactic noise and increases informational density. Most other serialization formats end up putting in indentation anyway to make them readable (JSON, TOML).
- aliswe 6y agoThat's a map as a list element, iirc the terminology. But check out this. When studying the Yaml spec I discovered that a map property (key: value) can have not only a string as its key, but any value. Even a list. (cue screams)
- shahsyed 6y agoHere's another reason why YAML is bad: the fact that I have to read the spec to figure out what's going on. It should have been fairly simple to do this. Why do I have to know the difference between ":" and "=" ...?
- Already__Taken 6y agoWhy didn't anyone learn from CSS when we all made pre-processors like stylus, less and sass that added white-space sensitivity. It's not great. I thought HCL was one of the best attempts at a terse config language. Shortening foo { bar { bazz {} }} to foo bar baz{} cleans up plenty.
- corty 6y agoYAML is unusable without a sufficiently capable linter. Syntax is very fragile and completely decoupled from function.
- shahsyed 6y agoYou're partially kidding but you're 100% right. Someone in another thread mentioned using some LISP or LISP-like language to solve this problem. Would something like TOML make things better here? What would have been the solution?
- pjmlp 6y agoXML, but I guess I won't get many friends for asserting that.
- secondcoming 6y agoNope. Json has schema validation too, and every language has a json parser
- pjmlp 6y agoJSON doesn't do comments.
- secondcoming 6y agoNot officially, but it's fakeable
- pjmlp 6y agoWhich for me is a design smell, why bother with workarounds when XML already offers me all the best tooling out of the box.
- secondcoming 6y agoFor me, xml is just too much, and when working with C or C++ (not t sure about rust) it's just a pain. Can your json schema file not serve as the documentation?
- 6y ago