13.6.4.12 Runtime Semantics: ForIn/OfHeadEvaluation ( TDZnames, expr, iterationKind, labelSet)
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:
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
people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind-labelset, 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?Thanks!
Axel