Comments on Refutable Patterns proposal

Brandon Benvie bbenvie at mozilla.com
Thu Mar 21 10:51:15 PDT 2013


On 3/21/2013 10:14 AM, Axel Rauschmayer wrote:
>
>> 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?
I wouldn't expect that at all, for the same reason I would expect `let { 
x, y } = { x: 1, y: 2, z: 3 }` to work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130321/c0fd0986/attachment.html>


More information about the es-discuss mailing list