10 biggest JS pitfalls

Quildreen Motta quildreen at gmail.com
Thu Jan 3 10:42:09 PST 2013

I'm still amazed to see people rant about other people's perfectly fine
coding styles, when those are an overtly subjective matter, and therefore
no argumentation on whether "Yes ASI" or "Nay ASI" can be right.

The only facts about ASI are:

1.) It's a syntax error;
2.) Such syntax error is spec'd to be "fixed" in a deterministic process —
no "guessing" games here from a grammar POV;
3.) No absolute consensus on whether it's a good or bad feature exists;

On the other hand, Python and Haskell programmers seem to be fairly happy
with ASI in their languages. I, despite being a Pythonista, actually prefer
ECMAScript ASI rules to Python ones, but as Brendan said, more newline
significance would "solve" part of the "problem" — as in, we'd have rules a
bit closer to what Python has.


As for the list, I'd rather put the implicit errors that might go unnoticed
due to scoping/binding warts up there. Clearly calling a function without
defining an object should have |this| as Null (fixed) — and it aligns more
with the "Functional First" thingie —, and assigning to undeclared vars in
the current or upper-scopes should throw an error rather than create a new
property in the global object.

On 31 December 2012 15:47, Jorge Chamorro <jorge at jorgechamorro.com> 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*.
> 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!
> --
> Jorge.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

Quildreen "Sorella" Motta  (http://killdream.github.com/)
— JavaScript Alchemist / Minimalist Designer —
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130103/8ef0ac20/attachment.html>

More information about the es-discuss mailing list