Isiah Meadows wrote:
Would this be rectifiable with something like an unbound lambda type syntax?
There's nothing to rectify -- could do m() expr; in classes as shorter form of m() { return expr; }, and similarly in object literals (, as separator, not ; as terminator).
What gates this concise body for method shorthand idea is strong sense it's worth the added complexity (syntax should be added only with clear and strong signal that it's needed, e.g. to provide a special form for new semantics that cannot be provided by an API). And then someone to do the work drafting an ES7 proposal.
What stopped thin-arrow function syntax when I got fat-arrow through TC39 was the idea that two arrows was a bridge too far. That sense might change with time user demand, but it's not something to rush. Anyway, thin arrow is not related to this thread.
You could even make an analogous equivalent for classes.
Sure, but why require thin arrow for method shorthand, when method requires unbound `this`? Allowing fat arrow seems a hazard with no real use case motivating it. In any case, grammatically we need no arrow at all. There's no grammar issues AFAICS with concise methods of the m() expr; form, provided expr is parsed as an AssignmentExpression and ; is required.
/be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

