[Pitch] Allow trailing comma in tuples, arguments and if/guard/while conditions

This is certainly not the case; the lookahead performed by the parser is fairly well-bounded and it's fairly trivial to detect when many statements should end even without explicit terminators based on what immediately follows. Parsing is not the performance bottleneck for compilation in any way that I'm aware of. If you doubt this, I'd encourage you to profile it (or, more simply, just run the code through swift-format—which uses the same parser—and observe the behavior).

The problems you're describing (especially since you're referring to SwiftUI) are more likely due to the type checker/constraint system trying to find a solution to something that has deeply nested structures and an error somewhere among them that makes it difficult to converge. It's a fair criticism in its own right (and the compiler authors have done a lot of great work already to improve it compared to past performance), but those problems are entirely unrelated to statement termination or trailing commas.

7 Likes