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

Splats in array destructuring for single-item arrays #3510

Closed
matthewwithanm opened this issue Jun 6, 2014 · 1 comment
Closed

Splats in array destructuring for single-item arrays #3510

matthewwithanm opened this issue Jun 6, 2014 · 1 comment

Comments

@matthewwithanm
Copy link
Contributor

I did a search and didn't see anything about this (it doesn't appear to have been brought up in #870), but independent splats in array destructuring assignments seem to have a behavior that's inconsistent with their named cousins:

[a, ..., z] = [1] # a = 1; z = 1
[a, yada..., z] = [1] # a = 1; z = undefined

The latter matches the es6 proposal and is what I expect, while the former feels like a bug.

@GeoffreyBooth
Copy link
Collaborator

This is still the case in CS2 now that destructuring compiles to ES syntax. I’m not sure it’s a bug, exactly, and I wonder about the consequences of changing this behavior now. A pull request would be welcome.

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

2 participants