News for hackers. Stuff that matters.
Re:XML is better than YAML by mumblemumble on Thursday September 21, 2023 @12:02AM (#37593084)
In XML's defense, the attribute-vs-child-element choice is always obvious and straightforward when you're using it as a markup language. It's only when you use it as object notation that it becomes wonky, because there the choice simply doesn't map to any straightforward characteristic of the problem domain. I'm not sure I want to hold XML responsible for not being good at being something it isn't.

And, on that note, I think that if I could pick as single thing that irritates me the most about YAML, it's that it isn't actually a ML.

Re:XML is better than YAML by unscaled on Thursday September 21, 2023 @12:08AM (#37593120)
I'm not criticizing having attributes-vs-child-elements. The problem with XML is not that it exists or that it is a particularly badly designed markup language.

The problem is that XML is ill-suited for configuration files.

Re:XML is better than YAML by baq on Thursday September 21, 2023 @01:43AM (#37593637)
Yeah JSX and especially TSX would be quite nice. YAML though can’t die soon enough.
Re:XML is better than YAML by moritzwarhier on Thursday September 21, 2023 @07:34AM (#37596113)
You think that JSX would be suited for configuration files?

Why?

I don't understand your comment.

Re:XML is better than YAML by baq on Thursday September 21, 2023 @11:16AM (#37598897)
Because people reinvent half of it, different half every time in each project, and call it 'configuration' which somehow gives them licencia poetica for whatever crazy dung they come up with.

Compare ansible vs helm vs github actions vs literally anything with nontrivial config.

Note that if you asked me for real, I'd be a dhall proponent, but most normal people look at me funny the first time they hear it and then the second time they see the syntax.

Re:XML is better than YAML by moritzwarhier on Thursday September 21, 2023 @01:41PM (#37601166)
dhall looks nice actually! Thanks for elaborating :)
Re:XML is better than YAML by wokkel on Thursday September 21, 2023 @02:42AM (#37593987)
Why? I can store it in version control. I can validate if the file has syntax errors or schema errors etc. etc. With a proper platform it's easy to generate or parse. It allows for both hierarchical structures (looking at you .ini). The only downside might be that you need a larger library to parse it. But i probably encounter xml somewhere along the line anyway due to interactions with a 3rd party system, so that point is moot.
Re:XML is better than YAML by dvdkon on Thursday September 21, 2023 @03:59AM (#37594549)
You have a low bar for config languages. I'd also like one to not be overly verbose, not be clearly intended for markup instead of object storage and not have security issues until you configure the parser just right (though that's often not an issue with configs). XML fails all of these, and YAML isn't much better.

If we're limiting ourselves to just JSON, INI, XML and YAML as potential choices, I get why people cling onto one of these suboptimal choices and then fiercely defend it, but there are other options. There's libconfig, JSON5, Dhall, various interpreted languages...

Sadly these alternatives are far from mainstream and have no support in standard libraries, so I think most developers will continue to pick whichever common option's issues they can deal with.

Re:XML is better than YAML by PH95VuimJjqBqy on Thursday September 21, 2023 @03:39PM (#37603030)
I'd like my config files to have two words in it "do it" and for it to just know what I want.

But at the end of the day that's not possible because reality intrudes. You give up a lot for that lack of verbosity, not everyone will agree that it's a worthy tradeoff.

Re:XML is better than YAML by GoblinSlayer on Thursday September 21, 2023 @09:43AM (#37597502)
It's a noble goal to want a simple configuration format, toml is far from the simplest, line separated options format is simpler. The fact that it needs a parser indicates that it creates a bigger parsing problem than necessary.
Re:XML is better than YAML by dragonwriter on Thursday September 21, 2023 @01:41AM (#37593608)
> And, on that note, I think that if I could pick as single thing that irritates me the most about YAML, it's that it isn't actually a ML.

“YAML ain't markup language” is kinda the whole point.

Re:XML is better than YAML by LukeShu on Thursday September 21, 2023 @01:55AM (#37593710)
For a full year it stood for "Yet Another Markup Language".

First draft: https://yaml.org/spec/history/2001-03-30.html

Last draft calling it that: https://yaml.org/spec/history/2001-12-10.html

First draft with the new acronym: https://yaml.org/spec/history/2002-04-07.html

Re:XML is better than YAML by xorcist on Thursday September 21, 2023 @04:47AM (#37594914)
It's also funny that the file extension YML is the successor of XML, so the rest is probably a backronym from that.
Re:XML is better than YAML by thaumasiotes on Thursday September 21, 2023 @06:28AM (#37595677)
Wouldn't the successor of XML be XMM?
Re:XML is better than YAML by mumblemumble on Thursday September 21, 2023 @08:28AM (#37596619)
Next you'll be telling me Beyonce's sisters should be named Beyoncd and Beyoncf instead of Aeyonce and Ceyonce.
Re:XML is better than YAML by mvandermeulen on Thursday September 21, 2023 @10:32PM (#37607188)
Feyonce can’t get anyone to believe she’s married and Vakira’s has astonishingly honest hips
Re:XML is better than YAML by dragonwriter on Thursday September 21, 2023 @11:09AM (#37598781)
Judging from BCPL, the successor should just be Y.
Re:XML is better than YAML by dragonwriter on Thursday September 21, 2023 @11:07AM (#37598764)
The file extensions for yaml is .yaml, .yml is the alternative because of legacy 8.3 systems.
Re:XML is better than YAML by throwawaymaths on Thursday September 21, 2023 @09:21AM (#37597231)
The thing is if you're using it as configuration language, object notation is correct, not markup.
Re:XML is better than YAML by taeric on Thursday September 21, 2023 @10:30AM (#37598160)
I'm curious why you think that is? Especially since you are likely to want to style the configuration for display to the user in many cases, having it be a document makes a lot of sense.

That is, if the value is something you would expect to be able to show to a user, then it probably shouldn't be at attribute. If it is a value that changes how you would show it, then attribute makes a lot more sense.

I also think a strong adherence to any preference between attribute and markup is a touch too dogmatic. The only real distinction at the language level is if you allow children, or not. If it can have children, it pretty much has to be a child and not an attribute.

Re:XML is better than YAML by throwawaymaths on Thursday September 21, 2023 @11:55AM (#37599540)
Ok forget the difference between attribute and markup. What is the "right" way to think of this:

    <foo>
      <bar>1</bar>
      <bar>2</bar>
      <baz>3</baz>
      <baz>4</baz>
    </foo>
Re:XML is better than YAML by taeric on Thursday September 21, 2023 @12:37PM (#37600189)
Why do you think there is a "right" way?