Rest parameter syntax

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jun 12 09:21:53 PDT 2012


We have had several previous discussions about such possibilities on this list.

Bottom line, is that destructuring (including formal parameters) could be moved towards something that is more like generalized pattern matching.  However, it isn't clear that the additional specification, implementation, and usage complexity is justified at this time.  For ES6 we have the most important use cases covered. If experience  with it suggests that some generalizations would add real value we can consider them for future editions.

Allen



On Jun 12, 2012, at 9:10 AM, T.J. Crowder wrote:

> On 12 June 2012 17:03, Herby Vojčík <herby at mailbox.sk> wrote:
> function foo (a, b, ...rest, c, d) { ... }
> foo(1, 2, 3)
> 
> What here?
> 
> Yes, [1, 2, [], 3, undefined] is probably the most logical one. But then d is not the last one (yes, it is only last one when there is at least four of them).
> 
> Yeah, I was regretting not addressing that case. :-) 
> 
> I'd say your interpretation (1, 2, [], 3, undefined) would be the best answer, and easiest to explain. There's a temptation to suggest that you could reverse c and d (1, 2, [], undefined, 3), but that way surely lies madness...
> 
> -- T.J.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120612/d917bcd9/attachment.html>


More information about the es-discuss mailing list