Refutable pattern

Brendan Eich brendan at
Fri Feb 1 12:39:54 PST 2013

Brendan Eich wrote:
> Prefix-'?' in an AssignmentPattern in an AssignmentExpression that is 
> an ExpressionStatement is ambiguous with the '?' in a 
> ConditionalExpression, if the programmer mistakenly relies on ASI as 
> if prefix-'?' were not used. Consider refactoring ES6 code with 
> prefix-'?' from
>    A = B
>    {D} = C
> L: E
> where D is the interior of an object destructuring pattern, to
>    A = B
>    ?{D} = C
> L: E

Oops, C \n L can't parse, so this will error. The difficulty could arise 
only if a ':' could be associated with the prefix-'?' to make a larger 
ConditionalExpression. I don't see a sentence where that could happen 
without an error, so this is less of an issue.

But it still seems like a good reason to kill prefix-'?', given the 
desire for patterns to be the same in destructuring binding and 
destructuring assignment.


More information about the es-discuss mailing list