3 ms·
My opinion: I can live with yaml and json. Toml,tjson if I have to. Xml with a gun to my head. But I don't want yet another markup language (ironically that's w
by _8j50 5y ago
My opinion: I can live with yaml and json. Toml,tjson if I have to. Xml with a gun to my head. But I don't want yet another markup language (ironically that's what YAML stands for)
- adorton 5y agoYAML stands for "YAML Ain't Markup Language"
- DonHopkins 5y agoThere was a previous discussion about YAML: YAML: Probably not so great after all (arp242.net) https://news.ycombinator.com/item?id=20731160 https://news.ycombinator.com/item?id=20731160 https://www.arp242.net/yaml-config.html https://www.arp242.net/yaml-config.html To which I posted: https://news.ycombinator.com/item?id=20735231 https://news.ycombinator.com/item?id=20735231 I was suspicious of YAML from day one, when they announced "Yet Another Markup Language (YAML) 1.0", because it obviously WASN'T a markup language. Who did they think they were fooling? https://yaml.org/spec/history/2001-08-01.html https://yaml.org/spec/history/2001-08-01.html XML and HTML are markup languages. JSON and YAML are not markup languages. So when they finally realized their mistake, they had to retroactively do an about-face and rename it "YAML Ain’t Markup Language". That didn't inspire my confidence or look to me like they did their research and learned the lessons (and definitions) of other previous markup and non-markup languages, to avoid repeating old mistakes. If YAML is defined by what it Ain't, instead of what it Is, then why is it so specifically obsessed with not being a Markup Language, when there are so many other more terrible kinds of languages it could focus on not being, like YATL Ain't Templating Language or YAPL Ain't Programming Language? https://en.wikipedia.org/wiki/YAML#History_and_name https://en.wikipedia.org/wiki/YAML#History_and_name >YAML (/ˈjæməl/, rhymes with camel) was first proposed by Clark Evans in 2001, who designed it together with Ingy döt Net and Oren Ben-Kiki. Originally YAML was said to mean Yet Another Markup Language, referencing its purpose as a markup language with the yet another construct, but it was then repurposed as YAML Ain't Markup Language, a recursive acronym, to distinguish its purpose as data-oriented, rather than document markup. https://en.wikipedia.org/wiki/Markup_language https://en.wikipedia.org/wiki/Markup_language >In computer text processing, a markup language is a system for annotating a document in a way that is syntactically distinguishable from the text. The idea and terminology evolved from the "marking up" of paper manuscripts (i.e., the revision instructions by editors), which is traditionally written with a red or blue pencil on authors' manuscripts. In digital media, this "blue pencil instruction text" was replaced by tags, which indicate what the parts of the document are, rather than details of how they might be shown on some display. This lets authors avoid formatting every instance of the same kind of thing redundantly (and possibly inconsistently). It also avoids the specification of fonts and dimensions which may not apply to many users (such as those with varying-size displays, impaired vision and screen-reading software).
- ashtonkem 5y agoWhich is more than a tad bit ironic, in retrospect.
- lawtalkinghuman 5y agoNot really since it's true. It isn't markup, it's a configuration file format. "<em>This</em> is a markup language" since there is text which is marked up. YAML/JSON is a way to serialise fairly common data structures (arrays/lists, hashes/dictionaries, numbers, strings, bools, etc.) Incidentally, if you can seamlessly replace XML with something like JSON, then you probably aren't using the 'markup' bit of XML.
- ashtonkem 5y agoAh, yes, that’s totally correct. I was mentally glossing over the difference between markup and configuration languages.
- PaulHoule 5y agoWhat I want from YAML (or a competitor) is access to the concrete syntax tree. For one of my art projects I make YAML files that describe the front side, back side, and web side of a "three sided card". I generate these out of several templates, currently using ordinary string templating. I'd love to be able to load a YAML file and add something programatically to the list and have the list stay in the same format that it was in, so if it was a [1,2,3] list I get [1,2,3,4] if it was a - 1 - 2 - 3 list I want - 1 - 2 - 3 - 4 sadly I'm the only one who thinks this way.
- stavros 5y agohttps://yaml.readthedocs.io/ https://yaml.readthedocs.io/
- Ciantic 5y agoYou are not the only one. But even if you find a library for YAML AST transformations for your language. What ever other language uses your YAML probably doesn't have it. E.g. I tried exactly the same thing, and it was quiet difficult with Rust. Because the way to parse it usually is with serde and it just removes the AST of course. In the end I gave up, and just used JSON for my use case.
- the_imp 5y agoIn JavaScript, use https://www.npmjs.com/package/yaml https://www.npmjs.com/package/yaml for this: import assert from 'assert' import { parseDocument } from 'yaml' const flowDoc = parseDocument(`[1,2,3]`) flowDoc.add(4) assert(flowDoc.toString(), '[ 1, 2, 3, 4 ]\n') const blockDoc = parseDocument(`\ - 1 - 2 - 3`) blockDoc.add(4) assert( blockDoc.toString(), `\ - 1 - 2 - 3 - 4 ` )