Revenge of the double-curly [Was: return when desugaring to closures]
P T Withington
ptw at pobox.com
Fri Oct 10 11:58:34 PDT 2008
On 2008-10-10, at 11:55EDT, Brendan Eich wrote:
> On Oct 10, 2008, at 5:44 AM, P T Withington wrote:
>
>> On 2008-10-10, at 02:29EDT, Brendan Eich wrote:
>>
>>> An agreement from TC39 this past spring was that function
>>> definitions
>>> directly nested in blocks, not specified by ES3, defined block-local
>>> (let) bindings.
>>
>> Holy smokes. Does that mean we are all going to be writing
>>
>> function ... () {{
>> ...
>> }}
>>
>> to get 'normal' scoping of function body declarations???
>
> No. My words were unclear, sorry. I wrote "defined block-local (let)
> bindings" meaning the functions defined in blocks bound *their own
> names* only in the containing block, not in the variable object.
Maybe _I_ am trying to be too clever. Is it not the case (per cited
agreement) that:
function foo () {{
function bar () {...}
}}
is sugar for:
function foo () {
let bar = function () {...}
}
whereas:
function foo () {
function bar () {...}
}
is sugar for:
function foo () {
var bar = function () {...}
}
? If so, perhaps you can see how I might imagine that:
function foo () {{
var bar = ...;
}}
might be sugar for:
function foo () {
let bar = ...;
}
Just playing devil's advocate.
More information about the Es-discuss
mailing list