That’s because there’s an out. “For convenience, however, such semicolons may be omitted from the source text in certain situations,” the ECMAScript spec explains.
This is done because programmers, aware that every additional character offers another chance to make an error, appreciate not being held to an exacting standard. It’s something akin to a just-in-time spell-checker.
Linus Torvalds in sweary rant about punctuation in kernel comments
Debates about the merits of ASI have been going on for years, and like the perennially unsettled conflict about whether source code should be indented using tabs or spaces, it remains a matter of disagreement.
“To be clear, we have no intention to deprecate or remove ASI,” said Daniel Ehrenberg, a systems software engineer for Spain-based consultancy Igalia and a former member of Google’s Linux kernel team, in an email to The Register .
As one of the co-authors of the proposal, Ehrenberg sees the recommendation as a way to ward off future problems arising from the growing complexity of ECMAScript.
The proposed wording says, “As new syntactic features are added to ECMAScript, additional cases requiring explicit semicolons emerge over time. As such, consistently explicit semicolon use is recommended.”
The intention here is to discourage reliance on ASI because there are situations where it may not be reliable and there are likely to be more such situations as ECMAScript evolves.
Nonetheless, the proposal, which has yet to be accepted as part of the ECMAScript standard, has detractors. In the Github comments on the proposal – a pull request – Berlin-based developer Yoshua Wuyts laments , “This makes me a little sad. JS is the only language I write, and I don’t use semicolons. I know it’s just a warning clause, but it sounds like the TC39 is saying we’re bad for using the language in a particular way. And it, feels, well, a little hurtful.” ®