On Tue, Jun 18, 2013 at 11:29 PM, Domenic Denicola
<[email protected]> wrote:
> From: Sam Tobin-Hochstadt
>
>
>> This is close, but not quite right.  The rule is that any unbound variables 
>> in modules are errors.  The variables may be bound by import declarations, 
>> or by lexical bindings such as `var` or `let`, or by bindings on the global 
>> object, or by top-level `let` bindings (which are not on the global object, 
>> IIRC).
>
> Is this correct then?

Yes, the below is all correct.

Sam

>
> ```js
> Date.now();
> ```
>
> is checked at compile time and found to be OK, because it is referencing a 
> binding that is a property of the global object that exists at the time of 
> static-checking. But
>
> ```js
> setTimeout(() =>
>     asdf(); // (A)
> }, 5000);
>
> setTimeout(() =>
>     window.asdf = () =>; // (B)
> }, 1000);
> ```
>
> is checked at compile time and found to *error*, because (A) is referencing a 
> binding that is a not a property of the global object at the time of static 
> checking? (Assuming an `asdf` binding is not introduced through any of the 
> other mechanisms you mention.) And this is true even though (B) adds such a 
> property to the global object before (A) ever runs?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to