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. In addition, Annex B http://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics provides an extended semantics for block level function declarations in non-strict code. That semantics is for use in implementations that need to provide backwards compatibility with the non-standard block level function declaration behavior that was provided by various browsers. Allen > > On Thursday, May 14, 2015, Bergi <[email protected]> wrote: > Alexander Jones schrieb: > > On Thursday, May 14, 2015, Domenic Denicola <[email protected]> wrote: > > > >> They can, in fact, be scoped in a for loop. > > > That's not what I see, in strict mode at least, which I assume most people > consider de facto by now! > > From V8: > > SyntaxError: In strict mode code, functions can only be declared at top > level or immediately within another function. > > That's ES5. In ES6, function declarations are allowed in blocks - with the > new block scope semantics. This was only possible as ES5 strict mode held > that spot open so now it doesn't break anything :-) > Yes, it will need a while until people get accustomed to that. > > Bergi > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

