A few arrow function specification issues

Brendan Eich brendan at mozilla.org
Mon Apr 23 14:44:57 PDT 2012


Brendan Eich wrote:
> 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. 

Dave Herman pointed out the shift for |this|-binding in function nested 
in arrow, under the proposal that arrow implies strict mode:

(x, y) => { obj.m = function(…){…} }

Again the break if that arrow is strict is for edge cases, not anything 
calling obj.m(...) or via prototype delegation. obj.m.call(undefined, 
...) would not substitute the global object, and primitives would not be 
boxed.

True enough, but I hang tough on wanting arrows to imply strictness. I 
may be wrong but the edge cases cited so far (global variable creation 
by assignment, 'with', direct eval injecting 'var' into its dynamic 
scope) along with this |this|-boxing one are underwhelming.

The other good point that came out in discussion with Dave was that 
module as implicitly strict works better (depending on your belief about 
future uses) than arrow as implicitly strict would, because (a) modules 
are bigger; and/or (b) modules are top-level (nesting only in other 
modules up to the top level) and cannot nest in functions or expressions.

I buy that as a one-off argument for imputing strictness to module 
bodies. I still think arrows could be next in line, knocking at the 
door, asking why they are getting the brush-off.

/be


More information about the es-discuss mailing list