Desugaring "for" and "let"

Brendan Eich brendan at
Mon Jul 11 09:41:14 PDT 2011

On Jul 11, 2011, at 7:18 AM, Axel Rauschmayer wrote:

> I remember that this has been previously discussed, but can't find the thread. For me, the above desugaring is easier to understand than the lambda coding.

Just recently: (thread head)

and previously:

> Compare: With Java, you have to declare
>    final int finalI = i;
> inside a for loop if you want to refer to i from an inner class.

Yeah, but that sucks so let's not cite it as any kind of precedent :-|.

Anyway, for-in and for-of with let give fresh binding per iteration -- that's the plan for

Ye olde C-style for(init; cond; update) {...} loops are thin veneer for init; while (cond) {... update}, and as Jon Z. pointed out, since you can take them apart accordingly, the binding semantics should not shift as you do.


More information about the es-discuss mailing list