restrictions on let declarations

Rick Waldron waldron.rick at
Thu Jan 30 09:14:54 PST 2014

On Thu, Jan 30, 2014 at 12:10 PM, Brendan Eich <brendan at> wrote:

> John Lenz wrote:
>> How did "let x" in for-loops land:
>> for (let x = 1; x < 10 ; i++) {
>>   // is "x" a fresh binding for every iteration?
>> }
>> This wouldn't be "block" scoping either.
> It is -- special forms that have heads can bind in bodies. We see this
> with formal parameters to functions, also with the defunct let blocks and
> let expressions of ES4. ML has similar forms.
> We made this block scoping, and how! Turns out Dart did the same. Each
> iteration gets a fresh binding. If there's a closure in the first part of
> the for(;;) head that captures the loop variable, it gets a "0th iteration"
> binding.

Also, there was very positive interest in Waldemar's proposed if-scoped
let, here:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list