4 ms·
Yes, semicolons are totally unnecessary. That’s why nobody who works on JavaScript has ever regretted that automatic semicolon insertion was added to the langua
by pwdisswordfishz 2y ago
Yes, semicolons are totally unnecessary. That’s why nobody who works on JavaScript has ever regretted that automatic semicolon insertion was added to the language. It has never prevented the introduction of new syntaxes to the language (like discussed here: <https://github.com/twbs/bootstrap/issues/3057#issuecomment-5135562 https://github.com/twbs/bootstrap/issues/3057#issuecomment-5...>), nor motivated the addition of awkward grammatical contortions like [no LineTerminator here].
- christophilus 2y agoThere are plenty of languages that don’t require semicolons and yet manage to avoid those issues: Clojure, Go, Odin…
- jmyeet 2y agoClojure delineates everything by explicitly putting statements in parentheses (like any LISP). That's basically the same thing. Go is an interesting example but it gets away with this by being far stricter with syntax IIRC (for the record, I'm a fan of Go's opinionated formatting).
- scotty79 2y agoAlso Scala
- 9rx 2y agoFunny enough, Go’s grammar does require semicolons. It avoids needing them typed in the source code by automatically adding them on each newline before parsing.
- ropejumper 2y agoOn almost every newline, which is the reason why this doesn't work: func thing() { I quite like this approach. It's very simple and consistent, and once you know how it works it's not ever surprising.