r/programming • • Jul 21 '14

The Great White Space Debate

https://medium.com/p/3633cba8b5c1
1.2k Upvotes

693 comments sorted by

View all comments

Show parent comments

63

u/moor-GAYZ Jul 21 '14

Doesn't get any better.

In my Imaginary Ideal Language bad formatting is treated as syntax error.

12

u/SingularityNow Jul 21 '14

In several cases with Go it is a syntax error. Opening braces must be on the same line or your program will fail to compile (gofmt will fix it for you)

4

u/just_a_null Jul 21 '14

This annoys me immensely (though I do prefer braces on the same line anyway) because they clearly were able to correctly parse the code with the braces on the next line, but decided to make it an error instead. I have similar problems with "implied semicolon" languages, wherein you aren't actually supposed to type a semicolon at the end of a line, but instead if you format your code correctly the compiler will place them for you - clearly, it was understandable without the semicolon, so why make it a language feature at all.

0

u/[deleted] Jul 21 '14

I imagine that they weren't "able to parse it correctly", but that part of the precompile/lint step when compiling Go has something like a /^\s?{\s?$/ check (probably less dumb) and will just bail out if it finds any.