Live data from Hacker News

YAML: Probably not so great after all

arp242.net

131–140 of 457 posts

Re: YAML: Probably not so great after all

#131
post #111

Earlier quoted context omitted.

Attributes are XML’s foot-gun.

Attributes are XML’s foot-gun. I disagree. Back in the day we used attributes for everything that was key value and inner tags for anything with structure. We also formatted for clarity: Compared with what we used to do, I look at attribute-less maven pom.xml with horror.

What if it's to be used by french speaking software/people ?

    
Or

    
          Dehors
          Außenseite
          Outside
    
Quite curious about it.

Re: YAML: Probably not so great after all

#132

I never understood how YAML is more human-readable than JSON. I find JSON much easier to read. What annoys me the most about YAML is that it's easy to misinterpret the indentation. You need a special IDE to know whether a property belongs to a specific object or to its parent.

> I never understood how YAML is more human-readable than JSON

Two things: comments and multi-line strings.

Re: YAML: Probably not so great after all

#133
post #64

Earlier quoted context omitted.

YAML 1.2 fixed this making booleans just true/false and it's a real shame that a lot of things still use 1.1

I’m sure Christopher True and Robert False really appreciate that “fix”.

So true. Your comment made my day.

Re: YAML: Probably not so great after all

#134

fish shell is looking for a new text serialization format for its history file (currently it uses an ad-hoc broken psuedo-YAML). Boxes to check: 1. Self describing format 2. SAX-style parser available to C++ 3. Easy for users to understand and ad-hoc parse using command-line tools 4. No document closing necessary, so appending is trivial YAML looks pretty good: - cmd: git checkout file.txt when: 1565133286 pwd: /home…

Obligatory "thanks for fish shell".

Try just using line-delimited JSON objects (http://jsonlines.org/). It ticks all of your boxes, especially 3: "jq -s '.cmd' fish_history | histogram".

Neither YAML or Protobufs are quite as easy as that.

All in all it's ridiculously simple, easy to parse in a variety of languages and each row is a single line that's simple to iteratively parse without loading the whole thing into memory.

Re: YAML: Probably not so great after all

#137
post #4

XML is as pleasant to look at or touch as a nettle rash, but it seems it can join ALGOL 60 among the ranks of technologies which were a great improvement on their successors.

Umm, no. You can find cases where JSON sucks, but you have to look for them. You can find cases where XML doesn't suck, but you have to look for them.

Numbers over 2^52. Unicode. Terminator vs. Separator. Weak type system no DTD. No Xpath equivalent. No namespaces.

Re: YAML: Probably not so great after all

#138
post #60

Earlier quoted context omitted.

I'd prefer XML because of the stability of the tools available for it. Recently I was writing a custom static site generator for my website. I started with python and yaml using the pyyaml lib. After two months (don't laugh, I wasn't writing this generator all this time; i had a break) I tested if everything I wrote previously was warking. Pyyaml came at me screaming that they deprecated something and I shouldn't use…

This sounds more like a Python and pyyaml problem than a YAML or JSON problem. Someone could come along and totally refactor XSLT even if XML stayed the same, and then you would be in the same boat.

Parent addressed your comment in his first sentence.

> I'd prefer XML because of the stability of the tools available for it.

Re: YAML: Probably not so great after all

#139

Earlier quoted context omitted.

It's not even the important half. If I have data that I need to send somewhere, and I can create the format for it, that's really easy to do. The problem, every time, is the reverse; receiving some piece of data and trying to figure out what parts of it I care about. Both XML and JSON allow for schema definitions, but in both cases it fundamentally requires me, as a consumer "grokking" what is being sent. And the ver…

What schema definition is there for JSON?

JSON Schema (no points for imaginative names)

https://json-schema.org/

Re: YAML: Probably not so great after all

#140
post #111

Earlier quoted context omitted.

Attributes are XML’s foot-gun.

Attributes are XML’s foot-gun. I disagree. Back in the day we used attributes for everything that was key value and inner tags for anything with structure. We also formatted for clarity: Compared with what we used to do, I look at attribute-less maven pom.xml with horror.

The decision of when and how to use attributes is the thing that is most often done wrong or clumsily in an XML file. That is my point.
Post reply on HN