Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What are these emerging declarative languages bringing to the table that will make people want to switch from what they’re using now? SDLang looks neat and clean, but to me it looks like JSON would get the same work down in the same amount of text. If your only gripe with existing markup languages is simply “I don’t like the syntax”, that’s a perfectly valid reason to switch. But are there any good objective reasons one should switch?


Let me bite this:

- JSON is massively underspecified. Its specification(s) alone can't produce multiple conformant implementations, as famously demonstrated by [1].

- JSON by its own is annoying to write because it doesn't support trailling commas nor comments. Most uses of JSON as configuration format (e.g. Visual Studio Code) would actually use (unspecified) extensions to make it more palatable.

- JSON has an undefined data model, generally thought to be a version of JavaScript values but not exactly. Have you ever dealt with 64-bit integers?

- JSON's (probable) data model lacks many important types, most notably a set, a true mapping with non-string keys and a byte array. You are likely to suffer if you need them. Disjunctive (or sum) types like `Ok(value) | Err(error)` are also painful to handle.

- JSON doesn't have a defined canonicalization algorithm, almost surely required by cryptographic protocols (and we live in the world where they are a thing). There are tons of mutually incompatible proposals.

- Being a subset of JavaScript, JSON is hard to parse efficiently and doesn't allow random access. Note that this is not unique to JSON and shared by many other formats including binary ones, but JSON is so ubiquitous that it is often used for inappropriate cases. It is not as impossible as simdjson [2] demonstrates (and multiple redundant syntaxes of JSON are actually beneficial for simdjson), but it's better to use random-accessible formats if you need performance.

- Being a subset of JavaScript, JSON is huge. Even much so if you embed it to other JSON (doubles quotes). Again, it's a problem mainly because of inappropriate uses. Pretty much any binary format will beat JSON in this regard.

[1] http://seriot.ch/parsing_json.php

[2] https://github.com/simdjson/simdjson




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: