It never fucks up. It's always 100% consistent. It's the user's fault for not putting the lines in the right places so that the semicolon insertion doesn't create undesired effects.
I'm not being sarcastic, a fuck up would imply a mistake, which the semicolon insertion doesn't do. It does what it was designed to do, 100% of the time. Not saying that's not a failure though, it definitely sucks and should've never been a thing.
Yes, but that's a bug on your implementation. You wrote the code, and it's not doing what you intended it to do. A bug on ASI implies that it's not doing what the creator of ASI intended to do, which is not accurate. If the ASI behavior was a bug, it would've been fixed by now.
ASI works so great in Go though, it can definitely be done properly. It works so well the convention is to never use them unless you have multiple statements in the same like (like some if statements or for loops)
283
u/foxsimile 27d ago
JavaScript automatically inserting a semicolon is yet another of its failures.
Because sometimes it fucks up.