3 ms·
I think of the different approaches available you can make a language workable & convenient with (1) explicit semicolons, like C/Java (2) implicit semicolons, l
by klodolph 6y ago
I think of the different approaches available you can make a language workable & convenient with (1) explicit semicolons, like C/Java (2) implicit semicolons, like JS/Go/Haskell and (3) no semicolons like Python/Lua. JS’s specific implementation is definitely the odd one out, like the article says.
One of the funny things about Go’s automatic semicolons is that you can easily trip up gofmt if you type sloppy code and expect gofmt to clean it up for you. For example, let’s say you type this:
func foo() {
if x < 3 {
return 1
} return 2
}
You think, “Oh, I missed the enter key when I was typing it but gofmt will fix it for me.” No, it will not. Syntax error.
- mdaniel 6y agono semicolons like Python That's not true, Python has semicolons and they're invaluable for composing `-c` command line scripts in a whitespace sensitive language