HNHacker News
TopNewBestAskShowJobs

GeneThomas

10 karma · joined December 25, 2022

Human
submissionscomments
GeneThomas··on New better alterative to XML, JSON and YAML
TER is irrelevant. The Internet has shown the advantages of text formats at the high level, e.g. email and the web.
GeneThomas··on New better alterative to XML, JSON and YAML
Make a point
GeneThomas··on New better alterative to XML, JSON and YAML
https://news.ycombinator.com/item?id=42038004#42038525
GeneThomas··on New better alterative to XML, JSON and YAML
See https://news.ycombinator.com/item?id=42038004#42049033
GeneThomas··on New better alterative to XML, JSON and YAML
Is canonilization not irrelevant. Any format with comments is not canonical; so xᴍʟ is not, ᴊꜱᴏɴ has escapes options for string characters so it not either.

Response to graph conjecture stated https://news.ycombinator.com/item?id=42072133.

GeneThomas··on New better alterative to XML, JSON and YAML
You misunderstand. Given that data MAY be a graph structure, the markup MUST support that. A tree with pointers to the parent nodes has a graph structure, a common enough occurrence.
GeneThomas··on New better alterative to XML, JSON and YAML
I mean it can be encoded inline, including using \n in strings
GeneThomas··on New better alterative to XML, JSON and YAML
See https://news.ycombinator.com/item?id=42049033

As terse as ᴊꜱᴏɴ.

GeneThomas··on New better alterative to XML, JSON and YAML
Good.
GeneThomas··on New better alterative to XML, JSON and YAML
> Again, how is this different from `xml:id`

It is a tidier solution.

> I still can't get what makes timestamps (and GUIDs) so special so that they have special sections in your document.

They are common in data.

> [...] boolean attributes

Separate attributes and sub elements is a mistake. One should be able to guess an ᴀᴘɪ.

> What more scalar types it can be extended with?

> letting the application make decision how to interpret these on its own.

That is laborours! A Xᴇɴᴏɴ library provides AsGuid, AsDateTime etc.. and serialization directly to/from those types.

>For whom? Humans?

Yes. Human have to read markup.

> Why would data encoding obey region number|date/time notation standards at all? English, but US, UK, Canada, or any other English-speaking country?

I repeat! READABILITY.

> Isn't it blind or crazy?

No, quite the opposite.

GeneThomas··on New better alterative to XML, JSON and YAML
See https://news.ycombinator.com/item?id=42056666
GeneThomas··on New better alterative to XML, JSON and YAML
I shall elaborate on the first paragraph of the web page:

• Terse.

Xᴇɴᴏɴ is as terse as ᴊꜱᴏɴ using 3 characters per scalar value <key=value> rather than ”key”:value, (4) or ”key”:”value”, (6). Xᴇɴᴏɴ is significantly more terse than xᴍʟ <key>value</key> (5+len(key)) around 10.

• Readable multiple line indented text.

ᴊꜱᴏɴ does not support multiple line text, forcing one to escape newlines as ‘\n‘. xᴍʟ looks messy with multiline line text as the text is copied verbatim, indenting is therefore from the left of the page. Xᴇɴᴏɴ allows one to indent text more than the enclosing markup.

Native support for arrays

Awkward in xᴍʟ.

• Native support for a graph structure, elements may have multiple parents.

Both missing from ᴊꜱᴏɴ and xᴍʟ where special fields are layers on top of the markup.

• Native support for a types used in serialization.

Also missing from ᴊꜱᴏɴ and xᴍʟ.

• Unambiguous choice of data structure.

No attributes.

• Efficient to write by hand.

see Terse. Also supports comments unlike ᴊꜱᴏɴ.

• Can be implemented to be blazingly fast or using a mode-less tokenizer.

Design decisions took performance and grammar simplicity into account.

• The xenon document is named.

Useful. One can see that the document is a <Person> or <Example-Document>

GeneThomas··on New better alterative to XML, JSON and YAML
I don’t love this.

> I can't see how different is that comparing to XML or JSON that semantically "have graph support" just because they also can declare something considered ids and references to the identified element.

When serialising data with ᴊꜱᴏɴ one has to use special field names such as $id; hoping the programming language does not. It DOES have native graph support that xᴍʟ and ᴊꜱᴏɴ do not.

> # [..] it may be a comment start

No.

> but what interoperability is all that about?

Interoperability between implementations. If you were using Xᴇɴᴏɴ to communicate between two different languages, say the C# and a Python implementation, agreeing of what an integer IS is helpful. Both Xᴇɴᴏɴ libraries can provide support for encoding say ɢᴜɪᴅs. You have missed the point. A user is always free to encode data as arbitrary strings.

> commas [...] readability." is just hilarious. Why should?

Commas makes numbers faster to interpret. Something `ls` is missing. As I stated on another branch English is the global lingua franca so commas every three digits is the standard.

> ∞ is allowed, but no mention on +Inf and -Inf, can be 4.2957×10^24 ∞ is +Inf. 4.2957×10^24 is not the xᴇɴᴏɴ standard.

>> It is more terse than ᴊꜱᴏɴ.

>Sorry, it's not.

See https://news.ycombinator.com/item?id=42049033

<<Timestamps>2026-09-24T16\:45\:22.5383742<&>2026-10-04T18\:25\:12Z<&>2026-04-02<$>>

Better than ᴊꜱᴏɴ which does not do timestamps.

GeneThomas··on New better alterative to XML, JSON and YAML
> why did you use comma instead of other characters for grouping?

Because English is the global lingua franca

> I like to hear why then

Unlike Unicode xᴇɴᴏɴ must be defined in one grammar. Having special names, like $type, and hoping no language uses them is fragile.

GeneThomas··on New better alterative to XML, JSON and YAML
A basic scalar pair in ᴊꜱᴏɴ is "key":"value", or "key":value, so a 4 or 6 character overhead. xᴇɴᴏɴ is <key=value>, 3 characters. In my tests xᴇɴᴏɴ IS more terse.
GeneThomas··on New better alterative to XML, JSON and YAML
> `<<$>` but not `<$>>`

Having both begin and terminate arrays start with << is more consistent.

> `<>` and `<&>` (`{` and `}`?).

Using `{` and `}` would lead to more special characters.

> Auto-removing whitespaces may hurt.

It does not.

> Graphs... But what does graphs make first-class citizens here and why?

It is simpler to support graphs in the markup. The fact is that the data being serialized may be structured in a graph.

> CR/LF

It supports LF only ᴜɴɪx line ends as well as CR/LF internet line endings.

> Comments [...] To be honest, I can't recall any instance I could see the percent sign elsewhere for this purpose

LaTex and PostScript both use % for comments. # matches the usage in ᴄꜱꜱ and ʜᴛᴍʟ, relating to an id/page location.

> What if the comments would start with a well-known `#` at least with a space right after it so that it wouldn't be considered a "graph id"

Having a space after the # differentiate between and id and comment would be a mistake.

> Scalars. Crazy [...] UUIDs

The Formats section is to facilitate interoperability between implementations, e.g. if you are encoding a ɢᴜɪᴅ [easy to say] then format it this way.

> not make it efficient in typing.

It is more terse than ᴊꜱᴏɴ.

> XML "v2" ... first-class array support

Xᴇɴᴏɴ has first class array support, the xᴍʟ like syntax leads to the <empty-arrray$$> notation.

> P.S. How does it look like in the document it marks up is minified (e.g., no whitespaces)?

Good.

GeneThomas··on New better alterative to XML, JSON and YAML
There exists a charset that is more efficient than UTF-8.
GeneThomas··on New better alterative to XML, JSON and YAML
It IS more terse than ᴊꜱᴏɴ and xᴍʟ and has many compelling features.
GeneThomas··on New better alterative to XML, JSON and YAML
JSON has superfluous quotes for the field names in objects, so overall xᴇɴᴏɴ is more terse than ᴊꜱᴏɴ.
GeneThomas··on New better alterative to XML, JSON and YAML
That is hard to believe, the data being serialized may always have a graph structure.
GeneThomas··on New better alterative to XML, JSON and YAML
Indentation in xᴇɴᴏɴ is optional and for readability.
GeneThomas··on New better alterative to XML, JSON and YAML
It is more terse than JSON.
GeneThomas··on New better alterative to XML, JSON and YAML
>But that doesn't really justify the use of comma in numbers.

Readability.

>I was asking why that particular variant [of Base64] was used.

I repeat, we are using the ʀꜰᴄ 4648 variant.

> [separate standards documents] do you think that's also a no-go? Yes.

Data model here:

document := named-entity

named-entity := named-object | named-array | named-scalar

named-object := NamedObject(name, object)

named-array := NamedArray(name, array)

named-scalar := NamedScalar(name, scalar)

object := Object(id?, type?, field*)

array := Array(id?, type?, item*)

scalar := Scalar(id?, type?, value)

field := named-entity

item := object | array | scalar

name := CHAR+

id := CHAR+

type := CHAR+

value := CHAR*

GeneThomas··on New better alterative to XML, JSON and YAML
> Consider the approach taken by XML 1.1

I evaluated xᴍʟ 1.0 and 1.1’s restrictions but consider the alternative, accepting anything but the empty string to be simpler.

>A lot of English-speaking countries actually have `.` and `,` swapped:

Which?

>...should state that encoders should pick a long enough decimal representation to avoid any such issue.

.net for example has round trip encoding to achieve this.

> Which base64 standard in [1]?

As linked in the document, we refer to ʀꜰᴄ 4648 for Base64 using the simplest version which states that “Implementations MUST include appropriate pad characters at the end of encoded data unless the specification referring to this document explicitly states otherwise”.

> I have outlined my rationale for layering in other comments.

>> Graph is generally a bad thing to encode at this level

The ᴅᴏꜱ attach you are concern about is not applicable. Layering graphs on top of the encoding in a separate standard is not practical. As stated serialization requires a graph structure.

>It is not too hard to define a data model in prose rather than code.

I have done that.

>May have been true in the past, but it's no longer true since SIMD-based parsers. Also the very existence of escape sequence prevents the true non-destructive zero-copy (aka in-situ) parsing anyway. With such sequences, zero-copy/in-situ parsing has to be destructive to be performant and that can preclude some use cases. Allowing additional space characters is much easier than that.

SMID based parsers would almost certainly run faster with simplified byte handling rules. Practically, when say skipping whitespace, searching for two specific bytes is faster than the alternatives. Most strings do not have escape sequences so do not need to be copied, a scan for '\' is fast.

> `<<Name>...<<$>`

This is to be terse. An array type in an xᴍʟ like language is a leap forward. Additional significant characters would over complicate the standard.

GeneThomas··on New better alterative to XML, JSON and YAML
- The flexibility in name is to support the plethora of programming languages.

- Commas are for readability as per English.

- Three digits are recommended for the encoder.

- Textual data is decoded into binary information in software so setting expectations, e.g. supporting ∞, facilitates interoperability by reducing impedance mismatches.

- If the implementation uses ɪᴇᴇᴇ doubles the rounding shall be as expected.

- Unicode surrogates are disallowed.

- We are following the Base64 standard exactly.

- It is essential for data to be structured as a graph, it simply occurs. Serialization on most data formats has the required support for graphs awkwardly layered on top of the encoding.

- The C# implementation defines the data model; essentially objects, array and scalars with multiple parents for nodes. The Formats section is to, as stated, facilitate interoperability.

- Limiting whitespace to spaces and tabs does speed processing. The ᴜᴛꜰ-8 bytes can be left in the input buffer rather than copied. All significant bytes are ᴀꜱᴄɪɪ.

- There are no unmatched angle brackets (that was a typo).

- I know the reasoning behind XML.

GeneThomas··on New better alterative to XML, JSON and YAML
See the opening paragraph.
GeneThomas··on New better alterative to XML, JSON and YAML
It has ALL of the advantages of xᴍʟ.
GeneThomas··on New better alterative to XML, JSON and YAML
Grudgingly ha ha. As per https://xenondata.org Xᴇɴᴏɴ is more terse than even ᴊꜱᴏɴ and has the advantages listed in first paragraph.
GeneThomas··on New better alterative to XML, JSON and YAML
The “readable indented text” refers to https://xenondata.org/#scalars where multiple lines of text can be indented and extracted as expected. One can argue that JSON is not readable due to requiring escaping (\n) for multiple line strings.
GeneThomas··on New better alterative to XML, JSON and YAML
The example you give is valid xᴇɴᴏɴ. The key and value may contain whitespace and must be delineated? <>s are that that made XML and HTML good.
← PreviousPage 2 of 3Next →