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

ES6 feature: Rest Parameters: tracking Issue #1011

Closed
4 tasks done
mikesherov opened this issue Feb 9, 2015 · 15 comments
Closed
4 tasks done

ES6 feature: Rest Parameters: tracking Issue #1011

mikesherov opened this issue Feb 9, 2015 · 15 comments
Assignees
Labels
Milestone

Comments

@mikesherov
Copy link
Member

Syntax:

FormalParameterList[Yield,GeneratorParameter] :
  FunctionRestParameter[?Yield]
  FormalsList[?Yield, ?GeneratorParameter]
  FormalsList[?Yield, ?GeneratorParameter] , FunctionRestParameter[?Yield]
FunctionRestParameter[Yield] :
  BindingRestElement[?Yield]
BindingRestElement[Yield, GeneratorParameter] :
  [+GeneratorParameter] ... BindingIdentifier[Yield]
  [~GeneratorParameter] ... BindingIdentifier[?Yield]

Spec:

https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functions-and-classes

Remaining Tasks:

@mikesherov
Copy link
Member Author

@ariya can you respond to the estree issue about rest and defaults? I think we may want to take acorns approach here.

@ariya
Copy link
Contributor

ariya commented Feb 15, 2015

@mikesherov I'm not sure why we want to deviate from the existing SpiderMonkey AST for this case.

mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 16, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs #1011
Closes gh-1050
@ariya ariya added es6 and removed es6migration labels Feb 18, 2015
@nzakas
Copy link
Contributor

nzakas commented Mar 2, 2015

Just a heads up: I was doing some experimentation and found that there's no good way to support both the harmony branch rest property and the newly-agreed Acorn-like approach (having the rest param in the params array) at the same time. This is because code exists that loops over the params array and then checks to see if rest has a value. That means adding the rest param into the params array would result in double evaluation of a rest param.

So we can really only do one or the other but not both (as opposed to handler and handlers, for instance).

@mikesherov
Copy link
Member Author

@nzakas no way to add a flag rather than doing a second loop?

@nzakas
Copy link
Contributor

nzakas commented Mar 2, 2015

Sure, but that's still a breaking change. My point is that existing code will break if we support both at the same time. If we need a breaking change, might as well go all the way and remove rest.

@mikesherov
Copy link
Member Author

@nzakas I see, you mean consumer code. I'm +1 for removing all the way.

@mikesherov
Copy link
Member Author

@jeffmo ^ ?

@jeffmo
Copy link
Member

jeffmo commented Mar 2, 2015

Agreed, let's rip the band-aid off

@ariya
Copy link
Contributor

ariya commented Mar 2, 2015

Hmm, maybe I missed something, but when did I discuss keeping the compatibility? Rest parameter was not feature in 2.0 anyway.

@jeffmo
Copy link
Member

jeffmo commented Mar 2, 2015

@ariya : I think the breaking-change-ness is only in reference to a breaking change within the harmony branch

@mikesherov
Copy link
Member Author

@ariya we sort of glossed over it in the meeting quickly. Glad we're all in agreement to just rip off the baindaid!

@mikesherov
Copy link
Member Author

@nzakas, you have sample code for the switch to restElement?

@nzakas
Copy link
Contributor

nzakas commented Mar 5, 2015

Assuming you mean consumer code that would be confused by having both, escope is a good example: https://github.com/estools/escope/blob/master/src/referencer.js#L221

ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit that referenced this issue Mar 5, 2015
@ariya
Copy link
Contributor

ariya commented Mar 6, 2015

@mikesherov Anything here that is still blocking 2.1?

@mikesherov
Copy link
Member Author

@ariya, yes, the switch from defaults/rest properties to resElement/AssigmentPattern

mikesherov added a commit to mikesherov/esprima that referenced this issue Mar 6, 2015
mikesherov added a commit to mikesherov/esprima that referenced this issue Mar 7, 2015
@mikesherov mikesherov mentioned this issue Mar 7, 2015
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants