Refutable pattern

Brendan Eich brendan at mozilla.com
Fri Feb 1 12:42:35 PST 2013


Claude Pache wrote:
> In case (1), there is no ambiguity with the conditional operator. In 
> case (2), one has to further analyse where a Pattern could appear.

Patterns can appear in formal parameter position, on the left of 
assignment ('=', not '+=' etc.), on the left of '=' in an initialized 
binding. I forgot about parameters in my suggested lookahead 
restriction, but the closing ')' is easy to handle and cannot occur 
legally after '?' in a ConditionalExpression.

So, lookahead restriction FTW! Or at least, let's get on with our lives. 
It saves having to duplicate most of the expression grammar a la the 
hated -NoIn productions.

/be


More information about the es-discuss mailing list