archives

« Bugzilla Issues Index

#3934 — 12.14.5 Destructuring Assignment: Parentheses in destructuring


12.14.5 Destructuring Assignment

From bug 3531 comment 2:

`(({}) = {})`, `[...({})] = []`, `[({})] = [{}]` and `({p: ({})} = {p: {}})` is currently not allowed.


12.14.1 Static Semantics: Early Errors
12.14.5.1 Static Semantics: Early Errors

> [...] if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral

This text does not match a parenthesized Object- or ArrayLiteral.


Also see 12.14.4

My recollection is that this syntax issue was discussed by TC39 when destructuring was being designed and that current spec. text reflects the conclusions of that discussion.

I'm reluctant to change this in ES6 without bring the issue back to TC39, and there really isn't time in the schedule to do that. However, since this is a syntax error, the restriction could safely be relaxed in the future.

Rather than closing this ticket, I'll reassign it to ES7.