Destructuring: Add early errors for empty patterns?
Standards Zakas
standards at nczconsulting.com
Wed Oct 21 18:19:23 UTC 2015
Hi all,
In playing with destructuring, it seems like there are some syntax gotchas
that really should trigger some sort of error and instead fail silently.
For instance:
```
let {} = foo;
```
This line does absolutely nothing and is most likely an error on the
developer's part. However, this is completely valid syntax and not a
parsing error. Fortunately, it's pretty clear from looking at it that
there's a problem. Another example isn't so clear:
```
let { bar: {} } = foo;
```
This one, I'd argue, is even worse. It looks like it should do something,
but silently does nothing.
Is there any possibility to add an early error for empty destructuring
patterns (array and object)? It seems like this would save developers a lot
of trouble in the long run.
--
________________________________________
Nicholas C. Zakas
http://www.nczonline.net
@slicknet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151021/3ee1cd85/attachment.html>
More information about the es-discuss
mailing list