Sam Tobin-Hochstadt (2013-07-11T01:06:40.000Z)
On Wed, Jul 10, 2013 at 8:02 PM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>
> On Jul 10, 2013, at 4:40 PM, Sam Tobin-Hochstadt wrote:
>
>> On Wed, Jul 10, 2013 at 7:24 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
>>>
>>> It gets created nowhere,
>>
>> This is right.
>>
>>> because the body of a module is implicitly strict,
>>
>> And this is right.
>>
>>> so the above code produces a Reference Error.
>>
>> But this is incorrect, because modules check that their bodies don't
>> have free variables, so the above code has a _static_ error.
>
> Ah, do you mean this is a link time check?
>
> It isn't a regular early error situations because gvar could be a dynamically added property on the global object.
>
> Not sure what your current semantics are, but I thought it was established a long time ago that modules needed free references in order to deal with global object properties.

No, that's not what I mean.  The semantics we've discussed multiple
times are that modules are compiled with respect to the global object
at compilation time, and free variables at that point (ie, compilation
time) are a static error.  This is implicit in the discussion here:
http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders (see the
"global objects" section) and explicit in some of the notes, I'm sure.

Sam
domenic at domenicdenicola.com (2013-07-13T01:09:14.653Z)
On Wed, Jul 10, 2013 at 8:02 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> But this is incorrect, because modules check that their bodies don't
>> have free variables, so the above code has a _static_ error.
>
> Ah, do you mean this is a link time check?
>
> It isn't a regular early error situations because gvar could be a dynamically added property on the global object.
>
> Not sure what your current semantics are, but I thought it was established a long time ago that modules needed free references in order to deal with global object properties.

No, that's not what I mean.  The semantics we've discussed multiple
times are that modules are compiled with respect to the global object
at compilation time, and free variables at that point (ie, compilation
time) are a static error.  This is implicit in the discussion here:
http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders (see the
"global objects" section) and explicit in some of the notes, I'm sure.