Language Rants Part 2: Language-Enforced Indentation


Originally posted: August 5th, 2007

Using indentation to define scope is a bad, bad idea. I'm looking at you, Python and SPIN. Like weak/dynamic-typing, it's fine for trivial programs, but as soon as you use it for anything more substantial it becomes a maintenance nightmare.

Let me clarify one thing: Of course you should always properly indent your code. However, the problem is when a language is designed to interpret that indentation as having semantic meaning rather than just ignoring it.

"But, if code should always be indented, shouldn't the compiler enforce that?" Not exactly. We should (and do) have tools that optionally enforce proper indentation. But such tools belong in places like the editor or the compiler's warnings, not in the language definition itself.

Leave a comment

Captcha