Make comma at the end of line optional

Naveen Chawla naveen.chwl at gmail.com
Wed Sep 13 13:57:01 UTC 2017


I'm not really familiar with ASI but they key factor mentioned in this
discussion is this (by Claude Pache):

*A implicit semicolon is not added when a declaration would be complete,
but when the next token would produce a syntax error. *

By this behaviour (a modification to the initial "complete statement
produces comma" version of this proposal), everything would work perfectly,
no?

The multi-line get would not produce a comma, and hence the scheme is
backwards compatible, right?

Please provide a counter-example if I have missed something.

As for the benefit, the time savings in not having to debug accidentally
omitted commas and not having to add them in the first place are, I think,
an improvement. And of course those who want to continue using commas
everywhere, can:

```js
function doStuff(
    x
    y
    z
){
}
```

```
const
   x = 5
   y = 6
   z = 7
```

Great to hear those counter-examples as I don't know enough about ASI, and
the related subject, to picture the pitfalls (sorry for my ignorance on
this). Also it would be good for reference on this proposal...

On Wed, 13 Sep 2017 at 18:40 Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 9/13/17 9:05 AM, Naveen Chawla wrote:
> > Can someone remind me of the problem doing it this way, if any?
>
> You mean apart from all the existing footguns ASI has?
>
> -Boris
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170913/d35ebff6/attachment.html>


More information about the es-discuss mailing list