4 ms·
One reason I've heard for the statement vs expression distinction, where one deliberately makes a mess of the syntax uniformity, is that it helps diagnostics of
by JonChesterfield 3y ago
One reason I've heard for the statement vs expression distinction, where one deliberately makes a mess of the syntax uniformity, is that it helps diagnostics of programming errors.
That is, by demanding spurious restrictions on syntax and generally making code more annoying to write, you get to detect more constructs as probably bad.
Line noise - semicolons in C, colons in python - is the same idea. Earlier diagnostics of code that probably wasn't intended.
I don't find this remotely compelling as a language design choice but it's the best justification I've come across for why so many have the extra obfuscation between programmer and AST.
Specifically, why would one optimise for ease of reading invalid code instead of for ease of reading valid code. Madness. But popular.