Description
In the ES6 spec., there is no check that a destructuring let/const/var actually introduces any bindings.
For example:
let ;
is a syntax error, but (updated 10/22/15)
let { } = obj;
is valid syntax that does nothing (it doesn't add any new variable bindings).
There are reports that some ES6 developers are encountering bugs cause by complex destructing patterns that unintentionally don't introduce any bindings.
This seems like a design bug in ES6. It would be trivial to specify that this is an early syntax error.
In 13.3.1.1
LexicalBinding : BindingPattern Initializer
- It is a Syntax Error if the BoundNames of BindingPattern has no elements.
In 14.1.2
FormalParameter : * BindingElement*
- It is a Syntax Error if the BoundNames of BindingElement has no elements.
Note that this is a breaking change for any program that actually contains such empty binding patterns. So there is some risk to making this change.