let function

Brendan Eich brendan at mozilla.org
Tue May 19 01:02:01 UTC 2015


I post this followup with some trepidation, as the es-discuss S/N ratio 
has dropped badly in recent weeks. Perhaps esdiscourse is doing better? 
Anyway, discussion fodder: @rauchg messaged me recently wondering why

let f = (x) => y;

could not be shortened to

let f(x) y;

This seems like a better shorthand to discuss, compared to `let 
function` (which function-in-block covers already, as noted).

/be

Allen Wirfs-Brock wrote:
> On May 14, 2015, at 3:39 PM, André Bargull wrote:
>
>>> On May 14, 2015, at 12:40 PM, Alexander Jones wrote:
>>>
>>>> Ah, thanks for explaining! What about the Temporal Dead Zone of let, or const binding semantics, for those of us who are obsessive enough to desire that kind of thing everywhere?
>>> ES6 specifies that function declarations are allowed in blocks in both strict and nn-strict mode.  In both cases they are block scoped and have essentially the same semantics (including a TDZ) as a let declaration.
>> There is no TDZ for block-scoped function declarations. Function declarations are basically hoisted to the top of the block.
>
> Ah right, I misspoke about on that point.  block level function declarations are indeed hoisted to the top of the block.
>
> Allen
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list