I think that would fail as well, because the let would be shadowing the
global x, which isn't allowed.
On Sep 18, 2015 2:25 PM, "Neil" wrote:
> Shu-yu Guo wrote:
>
> Good catch and thanks for the correction! The take-home from the example is
>> that: due to the global lexical scope, a TDZ error c
On 17/09/15 19:59, Shu-yu Guo wrote:
> Because until now, our global 'let' semantics have been identical to
> those of 'var', I have already landed a patch that mass replaces global
> 'let' with 'var' as part of bug 1202902.
I think someone should make you a "var is the new let" t-shirt...
Gerv
Shu-yu Guo wrote:
Good catch and thanks for the correction! The take-home from the example is
that: due to the global lexical scope, a TDZ error could arise later due to
newly introduced bindings.
So for that I guess the code would have to look like this?
var x;
function f() { dump(x); }
f()
Good catch and thanks for the correction! The take-home from the example is
that: due to the global lexical scope, a TDZ error could arise later due to
newly introduced bindings.
On Thu, Sep 17, 2015 at 7:34 PM, Boris Zbarsky wrote:
> On 9/17/15 8:26 PM, Shu-yu Guo wrote:
>
>> The first call to
On 9/17/15 8:26 PM, Shu-yu Guo wrote:
The first call to f() does not throw.
It actually does, because the bareword lookup for "x" fails. You get
"ReferenceError: x is not defined".
If you replaced "x" with "window.x" or "self.x" or "this.x" or something
I think you'd get the behavior you
(Isn't that bananas, by the way?)
On Thu, Sep 17, 2015 at 5:26 PM, Shu-yu Guo wrote:
> On Thu, Sep 17, 2015 at 5:18 PM, Neil wrote:
>
>> Shu-yu Guo wrote:
>>
>> 4. The global lexical scope is extensible. This means dynamic scope
>>> (lol!):
>>>
>>>
>>> function f() { dump(x); }
>>> f(); // pri
On Thu, Sep 17, 2015 at 5:18 PM, Neil wrote:
> Shu-yu Guo wrote:
>
> 4. The global lexical scope is extensible. This means dynamic scope (lol!):
>>
>>
>> function f() { dump(x); }
>> f(); // prints undefined
>>
>>
>>
>> let x = 42;
>> f(); // prints 42
>>
>>
>> Would you mind clarifying wh
Shu-yu Guo wrote:
4. The global lexical scope is extensible. This means dynamic scope (lol!):
function f() { dump(x); }
f(); // prints undefined
let x = 42;
f(); // prints 42
Would you mind clarifying what this is supposed to demonstrate? It looks
to me that this is demonstrating TDZ
8 matches
Mail list logo