4 ms·
Pretty neat, but isn't it like *two* formats: one binary and one textual?
by dorianmariefr 5y ago
Pretty neat, but isn't it like *two* formats: one binary and one textual?
- echelon 5y agoOne data model, two serializations of it.
- seniorsassycat 5y agoTwo representations of the same data structures. Ion text is like JSON, in fact all JSON is valid ion text. Ion text has comments, trailing commas, dates, and unquoted keys. It's a really good alternative to JSON, YAML, or TOML. Ion binary is compact and fast to parse. Values are length prefixed so the parser can skip over unneeded fields or structs, saving time parsing and memory allocated. Common string values, like struct keys and enum values, are given numeric ids and stored once in a header table.
- ComputerGuru 5y agoDo comments persist in binary serialization or is that a lossy one-way operation?
- the_girabbit 5y agoComments don’t persist in binary. Like white space, they are explicitly not part of the data model.
- seniorsassycat 5y agoI think the ion java library includes a AST parser that includes comments, but the ION data model doesn't. The binary format cannot include comments. I think many text parsers are missing libraries that edit documents in place, preserving formatting and comments.
- OJFord 5y agoConsider that binary, binary coded decimal, Gray code, hexadecimal, octal, etc. are all 'formats' expressing the same (numerical) idea. You can't say the same of, for example, YAML & JSON, since the former (if not the latter?) has constructs unrepresentable in the other. It's slightly confused because an application might 'serialise to' JSON or YAML or Ion equivalently - but really that's saying the application's data being serialised fits a model that's a subset of the intersection between those formats. You could call Ion two, but it's more than that in that it's also a promise that they're 1:1 (err, and onto if you like) - their intersection is their union.