Use syntactic parameter for AssignmentExpression

Kang-Hao(Kenny)Lu(平寿) kanghao.lkh at alibaba-inc.com
Thu Aug 7 10:53:08 PDT 2014


I have met at least one ES6 enthusiast who found AssignmentExpression
difficult to understand while trying to learn more about arrow
functions. Can we replace all uses of AssignmentExpression except one or
two to say, Expression[nocomma]?

Even better, if spec-wise backwards compatibility is not a problem,
could we just replace AssignmentExpression by Expression and the current
Expression by Expression[comma]. I think it better matches the mental
model of a normal programmer like me. Also, Java doesn't seem to allow
top level comma in Expression at all[1].

Speaking of which, shouldn't we use AssignmentExpression for
TemplateLiteral instead of Expression? It's not like we must parse a
full Expression within a balancing pair (we only allow
AssignmentExpression between '?' ':', unlike C[2] and C++[3]). Leaving
an extention point there for the future seems better. What do you think?

[1] http://docs.oracle.com/javase/specs/jls/se7/html/jls-18.html
[2] http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
[3] http://www.nongnu.org/hcb/


Cheers,
Kenny


More information about the es-discuss mailing list