Live data from Hacker News

YAML? That's Norway Problem

lab174.com

31–40 of 46 posts

Re: YAML? That's Norway Problem

#31
post #29

YAML is the worst format. You are literally one missing tab away from breaking your entire configuration file. Yet the industry keeps pushing it for the sake of “simplicity” - for small configurations sure, it’s fine, but many hundred lines of config entries? Good luck fixing it, if something goes wrong. I still can’t get why software engineers suddenly started to hate XML.

> You are literally one missing tab away from breaking your entire configuration file. In JSON, you’re one curly brace away from breaking your entire configuration file. How is that different?

I guess the missing brace is a scope delimiter and easy to notice if missing, while the tab is an indentation marker and much harder to spot, and might get you into an invalid state but still parse correctly, just not doing what it was meant to do

Re: YAML? That's Norway Problem

#33
post #31
post #29

Earlier quoted context omitted.

> You are literally one missing tab away from breaking your entire configuration file. In JSON, you’re one curly brace away from breaking your entire configuration file. How is that different?

I guess the missing brace is a scope delimiter and easy to notice if missing, while the tab is an indentation marker and much harder to spot, and might get you into an invalid state but still parse correctly, just not doing what it was meant to do

Additionally, file segments [0] written with a grammar that uses scope-defining character pairs survive round trips through email, chat, the paste buffers of a series of less-than-maximally-careful coworkers, etc. etc. etc. much, much better than those written with a grammar that uses whitespace to define scope.

Ask me how I know.

[0] sections? snippets? fragments? Hopefully you get what I'm trying to say here.

Re: YAML? That's Norway Problem

#34
post #29

YAML is the worst format. You are literally one missing tab away from breaking your entire configuration file. Yet the industry keeps pushing it for the sake of “simplicity” - for small configurations sure, it’s fine, but many hundred lines of config entries? Good luck fixing it, if something goes wrong. I still can’t get why software engineers suddenly started to hate XML.

> You are literally one missing tab away from breaking your entire configuration file. In JSON, you’re one curly brace away from breaking your entire configuration file. How is that different?

JSON isn’t ideal either, however missing curly braces are much easier to fix than figuring out where you misaligned entries without going through entire config file.

Re: YAML? That's Norway Problem

#35
post #29

Earlier quoted context omitted.

> You are literally one missing tab away from breaking your entire configuration file. In JSON, you’re one curly brace away from breaking your entire configuration file. How is that different?

JSON isn’t ideal either, however missing curly braces are much easier to fix than figuring out where you misaligned entries without going through entire config file.

I’d just like to know what kind of workflow you have that causes indentation to randomly change in your files.

Re: YAML? That's Norway Problem

#36
I wish there were a "strict" yaml. Another subset a la json, where you don't have nonsense like no === false, but "no" does not, but you also get the block style which to me is easier to read and write. I don't mind requiring quotes for strings. Modern IDEs make it easy enough and it removes ambiguity.

Re: YAML? That's Norway Problem

#37

Somehow my brain finds YAML hard to parse. JSON is easy but ugly. Lately I’ve just been using Python code in a module to initialize config settings. Initially it was just a lazy way to get started, but having the flexibility of an actual language is great when things evolve over time.

“Explicit is better than implict.”

—PEP 8

Re: YAML? That's Norway Problem

#38
post #23

Earlier quoted context omitted.

That was the initial intended use case for Python to be a configuration language.

Really? I thought that was more the case for Lua. Which by the way is more happiness per line of code than most other languages :-)

Actually, I remembered having read that in an old interview in the early 2000s, but I can't retrieve it now so it's safe to assume that it's a false memory.

Lua was designed to be an extension language though (checked on wikipedia this time :-D)

Re: YAML? That's Norway Problem

#39
post #6

Earlier quoted context omitted.

Long time ago i thought .properties was bad, as it has no structure. But later I realized repeating full path to every config param is really good for readability, and code reviews. The only thing I wish it had is @import-s from a separate files, that way we could split local/checkedin configs. YAML doesn't have @imports as well (only rudimentary from the same file), I have only seen them at HOCON.

You may be on to something. Imagine Yaml only in the editor. but stored (and code reviews consequently) are .property style.

IDE (like IntelliJ) can already do syntax coloring, autocompletion a even schema checking for known .properties. I don't see a reason in short names if I don't type them anyway, it's all autocompletion.

Re: YAML? That's Norway Problem

#40
post #39

Earlier quoted context omitted.

You may be on to something. Imagine Yaml only in the editor. but stored (and code reviews consequently) are .property style.

IDE (like IntelliJ) can already do syntax coloring, autocompletion a even schema checking for known .properties. I don't see a reason in short names if I don't type them anyway, it's all autocompletion.

ide doesnt save you from having the yaml in the wrong level. tried to look at a cloudinit file? it's pure insanity.
Post reply on HN