lexical for-in/for-of loose end

Jason Orendorff jason.orendorff at gmail.com
Thu Feb 2 17:07:03 PST 2012


On Thu, Feb 2, 2012 at 5:52 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> Unfortunately, having thought about it a bit since the meeting, I'm less
> convinced. We didn't look too deeply at possible capture scenarios such as:
>
> let geti;
> for (let i=(geti = function() {return i},expr), expr, incr = function(i++),
> decr=function(i--), cmp=function(){return i<n}; cmp();incr()) {
>        let j=i;
>        i +=10;
>        decr();
>        ...
>        If (j+-9 !== i) ...
>        ...
> }

What?! We should not reward people writing code like that.

I would be fine with the initializer-expression not being in the scope
of i at all.

-j


More information about the es-discuss mailing list