> For example, if JavaScript truly were to always require semicolons at the end of lines then that means this would be a syntax error:
Depends whether the semicolon is defined as a terminator or as a separator.
This would be valid code with statement separator semicolons.
Re:Brendan Eich: The infernal semicolon
by geoffschmidt on Sunday April 15, 2012 @07:53PM
(#3845206)
Couldn't the 'onClick' case have been solved by allowing either a statement or an expression to appear there?
<a onClick = "someFunc()" > ...
> Error, missing semicolon after ")" on line 1
That could get pretty annoying pretty fast, and simple little event handlers like these were probably the main use of JavaScript for the first x years. It also matched the existing philosophy of HTML which was to really go out of its way to make sense of whatever was in the file.
Now of course, the constraints are different: people want to use JavaScript for huge codebases and serious projects, so it makes sense that these decisions are no longer appropriate.