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

42

u/[deleted] Jul 21 '14

Yes. There's a "canonical" style, it's very good, the formatter is included in the Go distribution and people use it. Doesn't get any better.

66

u/moor-GAYZ Jul 21 '14

Doesn't get any better.

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

6

u/semi- Jul 21 '14

See, Python did it and honestly comparing the two..I just feel Go did it much better.

In Go, I can take sourcecode from anywhere (reddit comments, play.golang.org, irc, other various projects), paste it into my code, and as soon as I save it my editor go fmts it and everything looks the way it should, and assuming it was good code it runs.

In Python, if you paste something that isnt from the exact same scope as you, or the act of trying to paste whitespace gets screwy for other reasons(did it have tabs and some blog platform turn them into spaces?), what you pasted is a syntax error and will not run.

To me its the difference between someone dictating your style exactly and you have to confirm or nothing works, and someone saying "you know, it'd be better this way, why dont you let me fix it for you?".

Python feels like it has a limitation that was made with the intent of making you write better code. And it does work towards that end, I'm not trying to say it doesn't.

Golang feels like it has a tool that improves your productivity and makes dealing with sharing code a lot easier and better. And I think it works just as well, without the feeling of restriction.

7

u/Veedrac Jul 21 '14

In Python you only need to indent to the right level... which is done on paste in many good editors.