4 ms·
they should not be mandatory
by maaku 15y ago
they should not be mandatory
- masklinn 15y agoIf they're not mandatory, they should be out altogether unless required. Making them just optional is a path straight to js-land weird edge cases.
- munificent 15y agoThat's not true. Go, Python, Ruby and Scala all have optional semicolons without insanity. It's just that JavaScript's specific semantics for semicolon insertion (instead of newline elision!) are batshit crazy.
- jmesserly 15y agoAnd pretty much all functional languages get by just fine without semicolons (Lisp, ML, Haskell, etc).
- masklinn 15y ago> That's not true. Go, Python, Ruby and Scala all have optional semicolons without insanity. Python (and Haskell) solve that issue by not using semicolons unless required. The Dart code in the examples is full of semicolons, that makes it an "optional semicolons language" akin to javascript more than a "possible semicolons language" akin to Python or Ruby.
- munificent 15y ago> The Dart code in the examples is full of semicolons, that makes it an "optional semicolons language" Well of course they do because semicolons are currently required, but that says nothing about its relationship to JavaScript's inane semicolon insertion semantics, and I'm pretty sure you're smart enough to know that. All Dart needs to do is: 1. Treat both newlines and semicolons as the same kind of token (call it whichever you like). 2. Pick an elision strategy. Go's or Python's work fine. 3. Remove all of the ";" from your source files. No crazy JavaScript "rewind the parse and try again" insanity.