|
|
|
|
|
by z3t4
3321 days ago
|
|
I'm working on a text editor that automatically formats the code, it will have trouble with significant whitespace if the code is valid both with and without white-space, and even compiles, and even runs with or without, although with a possible hidden bug. I've never worked with a language with significant whitespace so I'm wondering, does it create bugs!? In my experience, bad formatting can cause bugs, or is annoying, eg. syntax errors like "missing bracket" and you got no idea where it's missing, which is why my editor does the indentation automatically and enforce it (you can't change it). |
|
But with braces, you can do consistency checks, such as that they are properly nested. In a similar way, you can do consistency checks with indentation. For example:
The third line is wrong, the transition from line 1 to line 2 introduced an indentation step, and the third line is neither left nor right.