4 ms·
If you squint at XML, JSON, or YAML you see a kind of lispy data-structure shape, an n-arry tree. The reader has a context stack that they are pushing and poppi
by simpaticoder 3y ago
If you squint at XML, JSON, or YAML you see a kind of lispy data-structure shape, an n-arry tree. The reader has a context stack that they are pushing and popping from as they read. The real problem is that every problem space is isomorphic to one that has successively tighter context. And a format that is applicable to every problem is one that is applicable to no problem. I believe that computer languages must get worse at some things to get better at others in a zero-sum way. Any attempt to avoid this trade-off leaves you with a very powerful mush.
- wodenokoto 3y agoNo, xml is inherently different. It’s a mark up language unlike the others which are data languages. In xml you can nest data inside of data. In json you can have data structures that can hold data. Eg., `<tag>lorem <tag2>ipsum</tag2>.</tag>` is not a thing in the others.
- simpaticoder 3y agoYour example shows taking a subset of a text node and wrapping in a tag. How many XML languages use this quality? The only ones I've ever worked with go to great lengths to not mix text nodes with other children nodes. And it's easy to see why such usage is considered poor practice: if you're making a language, you generally want more structure, not less. I'm not familiar with the distinction between 'markup languages' and 'data languages'. Ignoring the text/structured mixing issue, which I think is vestigial in XML and unused in DSLs, these are all isomorphic to each other and can nest data inside of data in a similar way: <person> <name>John Doe</name> <age>30</age> <city>New York</city> <employment> <position>Software Engineer</position> <company>ABC Tech</company> <years>5</years> </employment> </person> { "person": { "name": "John Doe", "age": 30, "city": "New York", "employment": { "position": "Software Engineer", "company": "ABC Tech", "years": 5 } } } person: name: John Doe age: 30 city: New York employment: position: Software Engineer company: ABC Tech years: 5