Make comma at the end of line optional

Алексей agat00 at gmail.com
Tue Sep 12 18:12:12 UTC 2017


The reason why we have a discussions about whether to rely on ASI or insert
them manually is because ASI has problems (return is one of them). And they
can't be fixed because fixes are not backward compatible. Based on this
experience it would be possible to determine the rules that would not have
that gaps or their kind.

2017-09-12 20:32 GMT+03:00 Claude Pache <claude.pache at gmail.com>:

>
> > Le 12 sept. 2017 à 18:57, Алексей <agat00 at gmail.com> a écrit :
> >
> > Don't you think that line break is a strong punctuation by itself?
>
> It could have been. Unfortunately, in JS, it is not.
>
> Automatic semi-colon insertion (ASI) could be seen as an attempt to have
> their cake and eat it too. Or, as a compromise between the two options by
> making *some* line breaks significant (e.g., the one after `return`).
>
> But in general, line breaks are not significant enough to allow to
> introduce ASI-like rules after the fact, that would work reliably enough.
>
> BTW, the title of the thread, “Make comma at the end of line optional”,
> reveals a probable misunderstanding of the feature. In JS, semicolons are
> not “optional”, they are “automatically inserted”. That makes a difference
> when parsing:
>
> ```js
> a = b
> +c
> ```
>
>
> —Claude
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170912/e5e416e7/attachment-0001.html>


More information about the es-discuss mailing list