argument lists as array structuring patterns and parameter lists as array destructuring patterns (Was Re: holes in spread elements/arguments)

Sean Eagan seaneagan1 at gmail.com
Mon Oct 3 08:19:56 PDT 2011


So I guess my deeper question is why we can't just do the following:

* argument lists as array structuring patterns:

ArgumentList :
  ElementList

* parameter lists as array destructuring patterns:

ArrayBindingPattern :
  [ ArrayBindingElementList ]

FormalParameterList :
  ArrayBindingElementList

ArrayBindingElementList :
  Elision<opt> BindingRestElement<opt>
  BindingElementList , Elisionopt BindingRestElement<opt>


ArgumentList and FormalParameterList could technically be replaced by
ElementList and ArrayBindingElementList respectively at this point,
just using them here for expository purposes.

The only difference I can see is that array structuring and
destructuring support elision whereas argument and parameter lists
currently do not.  But I'm not sure this difference makes sense, since
elision should be similarly useful at the function activation boundary
as it is at the assignment boundary.

Thanks,
Sean Eagan


More information about the es-discuss mailing list