Initializer expression on for-in syntax subject
Brendan Eich
brendan at mozilla.org
Fri Mar 14 15:31:10 PDT 2014
Geoffrey Garen wrote:
> I suggested to Oliver that we accept "Identifier = Expression in
> Expression” as valid syntax, but drop "= Expression” from the parse
> tree after the fact.
Note that the issue here is only legacy that uses 'var' before
Identifier. So you can't be sure of no compat break, since
for (var x = 'haha' in {});
with no enumerable properties on Object.prototype will iterate zero
times, and the hoisted var x will be initialized to 'haha' and available
after the loop.
> That way, we can still almost completely remove the construct from the
> language without harming web compatibility.
I wish. But let's just evangelize the site, and any others that use this
botch from the ancient world (JScript => ES1).
> I don’t see much value in making this decision based on strict mode.
> So far, we’ve got nothing but trouble from policies like that.
I agree we shouldn't fuss with strict mode, it doesn't pay. We should
impulse-shoot the bad old form, right between the eyes, in ES6.
/be
More information about the es-discuss
mailing list