On May 1, 2008, at 9:52 PM, Rob Pike wrote:
Indentation by white space is a very bad idea in my experience.
Superficially attractive but ultimately very dangerous. I once spent a
couple of days tracking down a bug caused by a source-to-source code
tool that broke a major program because the code it was injecting into
had indented one more space, causing the injecting code to break the
control flow. It was nearly impossible to track down.
This scenario is why I decided to require hard tabs as indents. You
can't use a space. But a space halts the indentation, so the problem
is still there. The next version will just ignore spaces, and treat
the first non-whitespace character as the beginning of a line.
I have lots of other examples of lesser disasters. As code grows,
white space indentation becomes ever more problematic. It's a
maintenance disaster.
Put it this way: It's unwise to make program structure depend on
invisible characters.
There's a language made entirely of said invisible characters, called
Whitespace. It's esoteric, but it works. And Python, which has the
same style, is a phenomenal success. Whether or not indentation works
relies on the programmer.