-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Why allow BindingPattern for BindingRestParameter #915
Comments
An example of JS that expresses why I think this is crazy:
|
@anba has raised a similar point here: tc39/proposal-object-rest-spread#43 |
I don't think it's a good idea since we will not be consistent with Array Rest spec that allows recursively rest operations. IMHO it could bring confusion against intuitive usage of rest operations. BTW, I think it's a good idea discuss this topic into tc39/proposal-object-rest-spread#43 since it is not part of spec yet. |
Do note the functional differences between The first example would only set a only if a is expr's own property, but the second example is equivalent to Though it does get redundant after one level of nesting, I don't see much point in |
What do you mean by “only set a”? “a” will end up as not TDZ after both statements execute. (FWIW, I understand there are other semantic differences in other ways to. Performing GetOwnPropertyNames is observable.) Having a semantic difference isn’t a good enough reason to be in the language. |
I think this can be closed now? The final spec does not allow this syntax. |
I'm looking at this spec text:
https://tc39.github.io/proposal-object-rest-spread/#Rest
and
https://tc39.github.io/proposal-object-rest-spread/#Rest-RuntimeSemantics-RestBindingInitialization
Why not only allow an identifier for rest?
For example, I think this code is too difficult to understand (and has little real world value):
What does this even do? Not what I would've expected it to.
I think I finally understand that it's something like this (with a lot of hand waiving):
The text was updated successfully, but these errors were encountered: