Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also allow trailing comma after rest element #8

Open
hax opened this issue Apr 30, 2022 · 0 comments
Open

Also allow trailing comma after rest element #8

hax opened this issue Apr 30, 2022 · 0 comments

Comments

@hax
Copy link
Member

hax commented Apr 30, 2022

Currently, let [a, ...b,] = iter or function f(a, ...b,) {} are syntax error.

As I understand, the intention of trailing comma is to allow move element easily when editing the code, especially in the code format like:

function f(
  a, 
  b,
  c,
) {}

it's easy to adjust the order of the whole line.

The rest element must be the last one, so there is no need to support trailing comma after rest element. It's actually protect programmers from appending elements after rest element.

But as this proposal allow a rest element be in any position, we should always allow trailing comma for consistency.

(Similar issue of other languages: python/cpython#53478 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant