Comments on Refutable Patterns proposal

Axel Rauschmayer axel at
Thu Mar 21 10:14:30 PDT 2013

> Yeah, rest patterns in other places were already decided out of scope
> for ES6 a while ago. And I did not include them here either because it
> is far from clear what a reasonable semantics should be for all kinds
> of corner cases. Just consider:
>  let [a, b, c, ...middle, x, y, z] = {'0': 0, '4': 4, length: 3}

I completely agree with them being tricky. But it might make sense to record that they have been considered and explicitly excluded from ES6.

> And with rest patterns at the end only, I don't think you'd ever want
> to write "..." without a subpattern. The only difference between [x,
> y] and [x, y, ...] would be that the latter (somewhat redundantly)
> checks the presence of a length property.

Ah! I would expect [x,y] to only match arrays whose length is 2. Is there a benefit to being more lenient?


Dr. Axel Rauschmayer
axel at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list