2 ms·
It looks nice! But it's still missing a semantics. When are two values equal? When are they distinct? JSON and most other formats also have no real semantics. X
by tonyg 6y ago
It looks nice! But it's still missing a semantics. When are two values equal? When are they distinct? JSON and most other formats also have no real semantics. XML is a notable exception, with XML infoset defining a semantics for the syntax. See also https://preserves.gitlab.io/preserves/why-not-json.html https://preserves.gitlab.io/preserves/why-not-json.html
- lifthrasiir 6y ago> JSON and most other formats also have no real semantics. This is true, but due to its origin I think we have a weak agreement over the JSON data model: it is a JavaScript value unless ambiguous. We do expect dotted number literals represent IEEE 754 binary64 numbers (importantly, this is pretty much the only case that excess precision do not alter the value), undotted number literals of the range (-2^31, 2^31) (exclusive) represent 32-bit integers, string literals with no lone surrogates and no unescaped U+2028/U+2029 represent Unicode strings, objects with no duplicate keys represent a partial mapping from strings to values. It is very common to avoid a valid but ambiguous and/or problematic subset of JSON, e.g. most encoders avoid unescaped U+2028/U+2029. Given that I think it is more useful to have a profile of JSON with the defined semantics than to have a substantially different format. Preferably that should be included to the JSON standard (RFC 8259, ECMA-404, ISO/IEC 21778 or whatever) itself. > See also https://preserves.gitlab.io/preserves/why-not-json.html https://preserves.gitlab.io/preserves/why-not-json.html Note that this link was also submitted to HN by its own: https://news.ycombinator.com/item?id=24946268 https://news.ycombinator.com/item?id=24946268