The only places where semicolons are ever used in the Node.js package
manager are in the 'for' loops headers and at the *beginning* of the lines
that would be interpreted incorrectly because of the lack of the semicolon
at the end of the *previous* line - for example see:
https://github.com/isaacs/npm/blob/master/lib/utils/read-json.js#L320-L336

There are no semicolons at the end of lines *at all*.

Also the commas in multi-line arrays and parameter lists are always written at the *beginning* of lines so Node also depends on the ASI *not* inserting
semicolons if the next line starts with a comma or other operator.

Thanks. It is useful to have such concrete examples.

And since I am quite confused - should I stop omitting semicolons, despite
the style used by Node and Joose? What is the safest way of writing code if I want to make my code work in the strict mode of new versions of ECMAScript
in the future? What if I want to contribute back to the Joose and Node.js
community?

Just an explanatory note from me, since I started this thread:

es-discuss is part of the public-facing interface to the Ecma TC39
committee. The committee "solicits continuing feedback from the
community during the specification of ECMAScript":

   http://www.ecmascript.org/community.php

So you're going to see members of the community (like myself)
making suggestions or raising questions. Members of the TC39
committee (like Brendan) also do some of their discussion here,
and respond to questions and suggestions (which is great, btw!-).

However, the detailed discussions and decisions happen elsewhere.
You can see them taking shape on the Ecmascript wiki

   http://wiki.ecmascript.org/doku.php

in the form of strawmen and proposals, and when those move
into the Harmony namespace

   http://wiki.ecmascript.org/doku.php?id=harmony:harmony

they are considered 'tentatively approved for the "ES-Harmony"
language', which is the next upcoming revision of ES.

In other words, no matter what options are discussed here,
until it appears on the wiki or is taken on by a committee
member, it isn't even officially under consideration.

[aside: it would be nice to know who the committee members
   are, and what the process is for starting an official proposal]

For the specific case of ASI, Brendan has explained the issues

https://mail.mozilla.org/pipermail/es-discuss/2011-April/013794.html

In brief, there is no way simply to take away ASI, and any
attempt to introduce a less troublesome variant of ASI will
have to offer a way to deal with existing code.

'legacy' code here refers not to ancient, badly written code
but simply to code using the current ASI, which is a legacy
from the point of view of any revised ASI.

ASI reform would not have the intention to force coders to
add semicolons everywhere, it would "merely" try to make
the rules of syntax easier to understand for coders and less
troublesome for language designers. The goal would be to
avoid unnecessary syntax while also avoiding unnecessary
worrying about how the mechanism works.

As a coder, you really don't want to add semicolons to
avoid ASI traps, as in line 232 of your example

   ;["dependencies", "devDependencies"].forEach(function (d) {

As a language designer, there are more than enough
issues to resolve, without having to watch your back
wondering how ASI will interact with new grammar.

Hope that clears up things a little?
Claus

(just another JS coder with language design
and tool building interests)
http://libraryinstitute.wordpress.com/about/


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to