Rick Waldron (2014-07-16T13:41:26.000Z)
Here are some relevant discussions from past meetings:

https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#proposal-part-2
https://github.com/rwaldron/tc39-notes/blob/master/es6/2013-09/sept-18.md#510-function-parameter-scoping-and-instantiation
https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-8.md#var-hoisting-and-catch-parameters



Rick



On Wed, Jul 16, 2014 at 2:13 AM, Andreas Rossberg <rossberg at google.com>
wrote:

> ES6 will have block scoping. However, it turns out that there are at
> least two different forms of blocks in the language:
>
> - normal block statements
> - block-like bodies hardwired into other constructs (try/catch bodies,
> function bodies)
>
> In the current draft spec, these come with different rules regarding
> shadowing. For example:
>
>   let x; { let x }  // fine, shadowing
>
>   for (let x...) { let x }  // fine, shadowing
>
>   try {} catch(x) { let x }  // redeclaration error
>
>   function(x) { let x }  // redeclaration error
>
>   (function x() { let x })  // fine, shadowing
>
> I think this subtle discrepancy is both unfortunate and unnecessary
> [1]. Moreover, with ES7 do expressions, I would like it to hold that
>
>   (...) => {...}    ≡    (...) => do {...}
>
> so the former shouldn't impose extra restrictions. Therefor, I suggest
> we implement the uniform principle that every braced statement list
> behaves like a proper block (i.e., allows lexical declarations to
> shadow outer variables, regardless of how those are bound).
>
> In terms of spec, this simply amounts to dropping several bullet
> points imposing syntactic restrictions about LexicallyDeclaredNames
> [2] -- i.e., simplification :). (Note: The legacy rule that legal ES5
> function declarations are var-like, not lexical, would of course be
> unaffected.)
>
> [1] issue: https://bugs.ecmascript.org/show_bug.cgi?id=3005
> [2] in current Sections 13.14.1, 14.1.2, 14.2.1, 14.3.1, 14.4.1
>
> /Andreas
>
> PS: With respect to try/catch/finally, I also wonder why we cannot
> simply relax the syntax and drop the hardwired block syntax. Then the
> block-scoping rules would follow naturally.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140716/b4619a2a/attachment-0001.html>
forbes at lindesay.co.uk (2014-07-16T22:32:29.601Z)
Here are some relevant discussions from past meetings:

 - https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#proposal-part-2
 - https://github.com/rwaldron/tc39-notes/blob/master/es6/2013-09/sept-18.md#510-function-parameter-scoping-and-instantiation
 - https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-8.md#var-hoisting-and-catch-parameters