Array tail destructuring

Cyril Auburtin cyril.auburtin at
Tue Oct 4 12:12:10 UTC 2016

I didn't understand everything discussed above, but to me, the only
asymmetry between head and tail destructuring is for infinite iterators:

`var [x] = neverEndingIterator` vs `var [...a, x] = neverEndingIterator //

in other cases plain arrays are quite symmetrical, they can be iterated
from the start or the end. Finite iterators are iterable only from the
start, but they would be 'expanded' in an array for tail destructuring.

So I think it would make sense to remove the "Uncaught SyntaxError: Rest
element must be last element in array" error, and maybe just let it freeze
if the iterable is infinite, that's programmer's responsibility
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list