10 biggest JS pitfalls

Brendan Eich brendan at mozilla.com
Mon Dec 31 11:06:27 PST 2012


Jorge Chamorro wrote:
> On 31/12/2012, at 15:55, Juan Ignacio Dopazo wrote:
>
>> I'm surprised not to see Automatic Semicolon Insertion in the list.
>
> Yes I would ditch ASI altogether if only to force the javascrhipsters to put back each and every semicolon where it belongs: they are *delimiters*.

Doesn't help this case:

   a = b
   (function () {
     ... // lots of lines
    })();

because it's easy to leave out a semicolon after b, even if you try to 
practice MSI (Manual...) and hate ASI. I've seen this mistake made by 
ardent MSI practitioners.

/be

>
> No ASI would force them to stop writing in those silly -and ugly- dialects in which every now and then lines *begin* with a semicolon...
>
> As JS compiler *wants* semicolons as delimiters, instead of attempting to "guess" and "fix" buggy src code via A.S.I. which often results in failure anyway (even silent failures which is worse), it should better halt and complain loudly about syntax errors.
>
> IOW, Javascrhipster's style code is nothing but a big multi line syntax error, fixed by ASI.
>
> Happy new year!


More information about the es-discuss mailing list