revive let blocks

Benjamin Gruenbaum inglor at gmail.com
Thu Jun 18 12:06:53 UTC 2015


Apart from complicating the engine and the grammar - what advantage does the second version have over the first one? Why do you prefer it to the first one? (Genuinely asking)

I'm also not aware of any other languages that provide this (although that's not a huge issue). 

> On Jun 18, 2015, at 05:27, Kyle Simpson <getify at gmail.com> wrote:
> 
> I'd like to ask if there's anyone on TC39 that would be willing to champion a proposal to add the let-block (let-statement) syntax?
> 
> I currently write my block-scoped declarations as:
> 
> ```js
> { let a = 2, b, c;
>   // ..
> }
> ```
> 
> I do this because I want to be in the habit of always putting my `let` declarations at the top of blocks to avoid TDZ hazards. However, Firefox has long had the alternate let-block/statement syntax, which I prefer:
> 
> ```js
> let (a = 2, b, c) {
>   // ..
> }
> ```
> 
> Would there be support to consider such a proposal?
> 
> Side note: I'd also be in favor of a `const (a = 2) { .. }` form, if the symmetry was appealing.


More information about the es-discuss mailing list