Comments on Refutable Patterns proposal

Tab Atkins Jr. jackalmage at
Thu Mar 21 10:54:51 PDT 2013

On Thu, Mar 21, 2013 at 10:51 AM, Brandon Benvie <bbenvie at> wrote:
> 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.

And in Python, for example, I often get annoyed when the interpreter
reminds me that the length of an unpacked tuple must be the same as
the originating tuple, even if I'm intentionally ignoring the end of


More information about the es-discuss mailing list