K
Keith Thompson
Skybuck Flying said:The original request was about preventing compilers from generating enormous
ammounts of error messages as soon as a bracket is missing. For example by
programming mistake or accident.
The compiler could do this by looking at the indentation which if used
consistently indicates where a statement block starts and stops.
So at the end of a statement block there should be a closing bracket... if
there isn't the compiler could simply stop right there instead of looking at
the rest of the code etc and generating invalid/crazy/stupid error messages
![]()
And how is the compiler supposed to detect the end of a statement
block? The closing brace *defines* the end of a statement block. (At
least it does in C; I'm reading this in comp.lang.c.)
As others have pointed out, there are languages, such as Python, in
which indentation is significant. (Old-style Fortran also requires
rigorous indentation, but that's a bad example.)
And as I mentioned here some time ago, it's possible for a compiler to
use indentation to guess at the intended structure of code, and
thereby give better error messages for missing braces. This doesn't
require indentation to be significant in the language.
None of this is new.