(x) => {foo: bar}
Brendan Eich
brendan at mozilla.org
Wed Jan 7 15:47:38 PST 2015
Allen Wirfs-Brock wrote:
> ObjectLiteral is already doing double duty covering ObjectAssignmentPattern. so this would be even more complexity in this area of the grammar.
Yeah, the complexity counter-argument is strong.
> Finally, I'm sort of on the side that this may not be so good for programmers. The rule, "if it starts with a { its a function body" is simple to teach and remember. Adding "except if the first thing is a labeled expression statement" (or whatever) is more difficult to explain and remember. More likely then not, all that many programmers would take away is "there are some special cases here that I don't really remember so I need to be really careful". I'm not sure that is an improvement over the status quo.
Me either, as noted up-thread. The option to prohibit a label at start
of body wouldn't commit us to doing block_vs_object_literal, though. It
would just carve out the future option. Still, no point in that work if
we think we will never take the option.
/be
More information about the es-discuss
mailing list