4 ms·
I designed the HOCON format. Here is my take on the why not JSON / why not YAML questions: https://blog.ometer.com/2015/09/07/json-like-config-a-spectrum-of-un
by hp 9y ago
I designed the HOCON format.
Here is my take on the why not JSON / why not YAML questions: https://blog.ometer.com/2015/09/07/json-like-config-a-spectrum-of-underoverengineering/ https://blog.ometer.com/2015/09/07/json-like-config-a-spectr...
Short answer is "UX"
There's also a historical reason, Play Framework and Akka had both invented ad hoc formats, HOCON replaced both. The ad hoc formats added things like includes and substitutions but in regex-hack type of ways. So HOCON was cleaning those older parsers up with a single actually-documented format.
- paulddraper 9y agoI've been using HOCON for years. Why it's not JSON: * includes * substitutions Why it's not YAML: * less confusing syntax (e.g. `cannot do that` doesn't need quotes, but `can't do that` does) * built-in support for overrides via env variables Why it's not JSON or YAML: * Built in durations! No more head scratching to figure out if 5 is seconds or milliseconds. It's just `5s`. --- JSON is a data transfer format. YAML is a markup language (or it claims to be...). HOCON is a composable configuration language. You always need to change, override, and deduplicate configuration in sensible way, in dev, in production, machine-by-machine. Despite a wart or two I think HOCON takes a sensible to this ubiquitous problem.
- kingbirdy 9y agoYAML isn't a markup language, and it doesn't claim to be. The name stands for YAML Ain't Markup Language.
- keville 9y agoExcept it originally stood for "Yet Another Markup Language"[1], and the newer name only means to separate it from HTML and other document-oriented markup languages. [1] http://yaml.org/spec/history/2001-08-01.html http://yaml.org/spec/history/2001-08-01.html
- cowardlydragon 9y agoEh, probably because XML was so prevalent when YAML came out, and the fact that XML in most programmatic contexts was just a serialized tree data structure, not a "semantic document" using "markup".
- kingbirdy 9y agoAh, I wasn't aware of the old name, thanks!
- paulddraper 9y agoAh, I hadn't heard of the retcon :) It was oirignally Yet Another Markup Language http://yaml.org/spec/history/2001-12-10.html http://yaml.org/spec/history/2001-12-10.html That's why it's YAML, not AAML, BAML, CAML, etc. In any case, yaml.org currently describes it as "human friendly data serialization". I don't think YAML is a bad choice, but HOCON's explicit focus on configuration yields some nice benefits.
- hp 9y agothere's also a little blurb at https://github.com/typesafehub/config#rationale-for-supported-file-formats https://github.com/typesafehub/config#rationale-for-supporte...
- sedachv 9y agoWhat advantages does HOCON have over s-expressions?
- firethief 9y agoSyntax is the paint, semantics is the bikeshed. Every interesting feature of this specification would still be applicable with a sexp syntax.
- paulddraper 9y agoAgreed, though I think you means to say semantics is the nuclear power plant.