3 ms·
I'd say that JSON is "structured", and probably HCL as far as I know, but the others have problems. I haven't worked with an API that uses XML in a long time,
by chubot 6y ago
I'd say that JSON is "structured", and probably HCL as far as I know, but the others have problems.
I haven't worked with an API that uses XML in a long time, but does it express the difference between "0123" and 123 well? I think that it either doesn't, or you add some really awkward schema language with XML namespaces ...
I just translated my .travis.yml to JSON, and I learned that
deploy:
on:
branch: master
gets translated to {"deploy": {"true": {"branch": "master"}}} because "on" is a synonym for true. I'd call that unstructured. It also has problems with keys that start with -, etc.
Also, all of the languages are often used with say Go templates, which makes them more unstructured. They're no longer statically parsable, which is "table stakes" for doing anything else (validation or static analysis).
I took some pains to make shell statically parsable [2], and I think it's now a better foundation than these config languages, per my other comment here: https://news.ycombinator.com/item?id=25483270 https://news.ycombinator.com/item?id=25483270
I think HCL is probably a lot better, but it also seems to be the least used! It's structured, and has its own mechanism for expressing duplication that's not the equivalent of a 70's-style #include.
[1] https://github.com/oilshell/oil/blob/master/.travis.yml https://github.com/oilshell/oil/blob/master/.travis.yml
[2] http://www.oilshell.org/blog/2019/02/07.html http://www.oilshell.org/blog/2019/02/07.html
- dehrmann 6y ago> "on" is a synonym for true And "no" is a synonym for false, hence "the Norway problem." https://hitchdev.com/strictyaml/why/implicit-typing-removed/ https://hitchdev.com/strictyaml/why/implicit-typing-removed/
- tannhaeuser 6y ago> I haven't worked with an API that uses XML in a long time, but does it express the difference between "0123" and 123 well? I think that it either doesn't, or you add some really awkward schema language with XML namespaces ... Is as easy as declaring <!ATTLIST data field NUMBER #IMPLIED> vs <!ATTLIST data field CDATA #IMPLIED> with DTDs.