|
|
|
|
|
by DmitrySoshnikov
2055 days ago
|
|
Great details, thanks! > A benefit of a syntax with indentation-defined block structure is that you don't need to rely on balanced grouping tokens like { ... } In fact from the lexer perspective there is no big difference, the matching indent-dedent is the same token type as would be { and } |
|
The moral of a lot of these tricks is that by turning idioms and conventions into language enforced constraints you can detect programmer errors more reliably and you can do a better job of error recovery. That said, even in a curly brace language like C# you could still use the indentation structure as a heuristic guide for error recovery--it's just going to be less reliable.