17 ms·
Significant 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 mysel
by cageface 6y ago
Significant 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.