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 <[email protected]> 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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to