On Sep 18, 2012, at 7:27 AM, Andreas Rossberg wrote:

> On 17 September 2012 19:51, Allen Wirfs-Brock <[email protected]> wrote:
>> 
>> On Sep 17, 2012, at 12:37 PM, Luke Hoban wrote:
>>> 
>>> These are good questions.  Paul will be attending the TC39 meeting this 
>>> week, and can likely talk to specific details.   High level though, we 
>>> statically eliminate the TDZ checks for references to 'let' within the same 
>>> closure body as the declaration.
>>> 
>> 
>> The other major check that I would expect to be significant, is whether a 
>> inner function that references an outer TDZ binding is (potentially) called 
>> before initialization of the binding.  EG:
>> 
>> {
>>    function f(){return x}
>>    f();   //TDZ check of x in f can not be eliminated
>>    let x=1;
>> }
>> 
>> {
>>    function f(){return x}
>>    let x=1;  //TDZ check of x in f should be eliminated
>>    f();
>> }
> 
> Unfortunately, detecting this case in general requires significant
> static analysis, since f might be called indirectly through other
> functions (even ignoring the case where f is used in a first-class
> manner).
> 
Yes but but there are fairly simple heuristics that approximate that result, 
for example:
   if no function calls dominate the initialization of x then TDZ checks will 
never need to be made for x
   
   
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to