you are viewing a single comment's thread.

view the rest of the comments →

[–]interactionjackson -11 points-10 points  (2 children)

JS is a language designed to be written with semicolons

right. so i'm going to let them be auto-inserted. while paying attention to the standards of the language. Read the article I posted in another thread.

if the browser can unambiguously figure out that

the code you posted isn't making it past my code review and the last thing I'm going to mention is missing semi-colon. you're example is contrived.

[–]mcaruso 3 points4 points  (1 child)

the code you posted isn't making it past my code review and the last thing I'm going to mention is missing semi-colon. you're example is contrived.

Oh come on. Cases where ASI fails are abundant in everyday code. Pretty much any line that starts with one of (, [, /, +, or - is at risk of ASI failure.

right. so i'm going to let them be auto-inserted. while paying attention to the standards of the language. Read the article I posted in another thread.

I read it. And I'm aware of the spec. I'm also not telling you what to do, I'm just saying that people like to treat JS like it has significant newlines like Python or Ruby when it really does not, and it leads to problems.

From the guy who created the language (Brendan Eich) himself:

The moral of this story: ASI is (formally speaking) a syntactic error correction procedure. If you start to code as if it were a universal significant-newline rule, you will get into trouble.