revive let blocks

Bucaran jbucaran at me.com
Sat Jun 20 14:17:38 UTC 2015


Hey Kyle

True for `continue` and `break`, but maybe it’s about time we stop using these archaic control structures anyway :)

As for `return` I don’t see what’s the problem if you return your value inside the IIFE as well.

Regards


> On Jun 20, 2015, at 10:10 PM, Kyle Simpson <getify at gmail.com> wrote:
> 
> Just to wrap this thread up, quoting myself from another thread:
> 
> "In any case, I won't push my proposal anymore."
> 
> ----
> 
> But for posterity sake, wanted to make one last comment as to why the various suggestions for IIFE's and arrow expressions are inappropriate for the task: they change (hijack) the behavior of `return`, `break`, and `continue`. A standalone block like `{ let x = 2; .. }` or `let (x = 2) { .. }` can be placed anywhere, inside a function, loop, etc, and not hijack these types of statements.
> 
> I'll be sticking with:
> 
> ```js
> { let x = 42;
> 
>    console.log("The meaning of JS: ", x);
> 
> }
> ```
> 
> Appreciate the various thoughtful responses.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list