Re:In praise of Go or "Why I moved from Python and C++ to Go"
by andralex on Wednesday November 17, 2010 @01:07AM
(#1913118)
Please make sure you give the example a close read, as it surprises even experienced Go programmers. Both examples look similar to code in the likes of C, C++, Java, and so on, _except_ the semantics gets radically changed depending on one line feed, which is very unlike those languages. I hope this clarifies things.
Re:In praise of Go or "Why I moved from Python and C++ to Go"
by jibal on Wednesday November 17, 2010 @02:12AM
(#1913265)
> I don't really follow what in your example shows "gross mishandling of whitespace".
That truly speaks poorly of you.
OTOH, the problem can easily be fixed by requiring a statement to contain at least one token.
Re:In praise of Go or "Why I moved from Python and C++ to Go"
by WalterBright on Wednesday November 17, 2010 @01:07AM
(#1913116)
The problem is that the code looks correct for anyone coming from C, C++, Java, D, Javascript, etc., but produces unexpected results.
Re:In praise of Go or "Why I moved from Python and C++ to Go"
by jibal on Wednesday November 17, 2010 @02:26AM
(#1913300)
It's an interesting way to enforce K&R indentation style.
The most popular languages are C, C++, Java and C# and Go's syntax is very similar to those. If anything, Python is the weird one in how it treats the whitespace and hence most likely to confuse people coming from other languages.
As to optional semicolon elision - what is the problem with that? They make the code cleaner looking and gofmt will remove them for you even if you forget due to C/Java reflexes. I don't see the downside of making them optional.