13.6.4.12 Runtime Semantics: ForIn/OfHeadEvaluation ( TDZnames, expr,iterationKind, labelSet)

allen at wirfs-brock.com allen at wirfs-brock.com
Wed May 13 15:22:03 UTC 2015


It makes things like this:
 
let x=0;
for (let x of (x=2, obj) {...}
 
produce an error. 
 
Essentially it is creating a TDZ for 'x' that spans the of expression. 
It doesn 't make a difference whether the TDZ binding for x is mutable 
or immutable because the binding is never initialized so any reference 
to it will produce an error. 
 
Allen

On Wed, 13 May 2015 15:41:36 +0200, Axel Rauschmayer  wrote:

       
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind-labelset
 
I don’t understand step 2: the temporary environment TDZ is created 
for step 3. All bindings of TDZ are mutable (even the `const`-declared 
ones). It looks like TDZ is thrown away afterwards. Why is this step 
necessary? Why are all bindings mutable


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150513/4b4f64e0/attachment.html>


More information about the es-discuss mailing list