revive let blocks

Bucaran jbucaran at me.com
Thu Jun 18 12:16:29 UTC 2015


Another way: Instead of using `let` at all, why not creating a function and pass it your `a`, `b` and `c` as arguments. 

Nowadays I try to program without explicitly declaring any variables, hence my suggestion.

```js
(function (a, b, c) {
    
}(2))
```

If you can post a more concrete example I would give you a more concrete suggestion to what I mean.

Cheers

> On Jun 18, 2015, at 9:06 PM, Benjamin Gruenbaum <inglor at gmail.com> wrote:
> 
> 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.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list