A few arrow function specification issues

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Apr 23 10:13:04 PDT 2012


On Apr 23, 2012, at 8:19 AM, Brendan Eich wrote:

> Andreas Rossberg wrote:
>> To be honest, that suggestion confirms one of my fears about "1JS" --
>> ending up with a more complicated language with ad-hoc rules about
>> which mode applies in which context. Please let's try to resist the
>> temptation. As much as I would like to encourage strict mode, I think
>> we should keep it orthogonal to other constructs as much as possible.
>> I can bear tying it to modules, but let's not go any further.
> 
> It's a good point (and I'm not one to "encourage strict mode" if there's no payoff for developers, but before agreeing, can you enumerate the cases that matter inside an arrow function body?
> 
> Without arguments runtime semantic shifts, and with |this| lexical, there aren't many strict mode changes left IIRC, and they are pretty edgy edge cases.

See Annex C.  Some strict mode highlights:

Assignment to an unbound name throws instead of creating a property of the global object

With statements are disallowed

direct eval can't instantiate new binding in the enclosing environment

duplicate formal parameter names are disallowed
   (I suggest we add this restriction to arrow functions even if we say they aren't inherently strict. )

Allen



More information about the es-discuss mailing list