5 ms·
Agree that invoking Python is probably counter-productive but I think the basic point is correct. I've banged my head against the wall many times trying to figu
by thinkharderdev 6y ago
Agree that invoking Python is probably counter-productive but I think the basic point is correct. I've banged my head against the wall many times trying to figure out which line in my 500 line YAML document is not indented correctly. Bonus point when Helm generates an invalid YAML document but because it is interpreted, the line number spit out by the parser is not a line number in your actual source template.
- cageface 6y agoSignificant white space is one of those ideas that’s very appealing in small examples and demos but falls apart in production. I was a big proponent of it myself until I saw it cause some very subtle production bugs. Now I’m more than happy to endure a little extra typing in order to be able to defer code formatting in complete confidence to prettier.
- acdha 6y agoThis highlights the importance of implementation: this is not a problem in Python because the language prevents those subtle inconsistencies whereas YAML tries too hard to accept anything and has a lot of magic syntax which makes it hard for tools to determine intent.
- cageface 6y agoIt's less of a problem in Python but it still exists. A lot of the day to day work of programming is moving and refactoring chunks of code around. Having to pay careful attention to white space the whole time makes this a lot more tedious and error prone than it is in languages without this feature.
- acdha 6y agoHaving spent the last couple decades writing Python professionally, it definitely happens but it’s rare outside of people using Notepad. The major programmers editors have been able to adjust indentation on paste for many, many years and, unlike YAML, that will get an immediate syntax error rather than parsing to something unexpected.
- ldiracdelta 6y agoI've seen the opposite problem in braced languages. People assume the indentation signifies a block and subblock level, then debug a weird logic flow and discover that the indentation blocking does not match the brace blocking, because someone didn't properly indent after adding a new set of braces. I like python because the parser and the human are both inferring meaning from the same data--indentation is the block.
- seanwilson 6y ago> I've banged my head against the wall many times trying to figure out which line in my 500 line YAML document is not indented correctly. How are tags or brackets better here? The "urgh, where's the missing bracket!?" problem has been with us for decades and it's not likely to go away until we move from text editors to structured editors. At least you don't have the problem of misleading looking indentation when the indentation itself is the single source of truth.
- thinkharderdev 6y agoXML and JSON are not immune to similar problems, but in my experience you run into it head first with YAML more because when copy/pasting YAML stanzas from one document to another, the indentation can (and often does) get mangled. Since whitespace isn't meaningful you can paste a JSON or XML object as without the whitespace, parse the document and then reformat it to display it nicely. With YAML if the whitespace gets mangled on paste then the document can't be parsed to begin with so the tools you generally use to debug such issues are largely useless. You are effectively back to raw text.