Is my understanding correct in interpreting that `((foo)) = 1` is a
valid expression in both strict and sloppy mode, but `({x}) = 1` is
not?Here's my logic: - https://tc39.github.io/ecma262/#sec-assignment-operators-static-semantics-early-errors This tells me that when the LHS is neither an array nor object literal pattern, an early error occurs if and only if IsValidSimpleAssignmentTarget of the left hand side is false. - https://tc39.github.io/ecma262/#sec-semantics-static-semantics-isvalidsimpleassignmenttarget In the second rule, it gets the covered expression and returns IsValidSimpleAssignmentTarget of its subexpression. - https://tc39.github.io/ecma262/#sec-static-semantics-coveredparenthesizedexpression The covered expression is the expression in parentheses. - The rules are applied recursively. After we apply the previous two rules again, finally do IsValidSimpleAssignmentTarget of the identifier `foo`. - https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-isvalidsimpleassignmenttarget `foo` is neither `arguments` nor `eval`, so IsValidSimpleAssignmentTarget is true. ----- So because the rules are applied recursively, and it recurses into `foo` and `{x}` respectively, it validates the former and invalidates the latter. Is my reasoning correct in this study? Or did I miss something important. In addition, if this is the case, there are two issues I see right off: 1. The recursion does not allow for the obvious extension of `({x}) = 1` as an expression. 2. This is either a spec bug that it's allowed, a spec bug it's not allowed, or a bug in multiple self-hosted ESTree parsers. ----- Isiah Meadows [email protected] _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

