Sam Tobin-Hochstadt (2013-07-11T02:33:40.000Z)
domenic at domenicdenicola.com (2013-07-13T01:10:25.563Z)
On Wed, Jul 10, 2013 at 10:12 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > Hmm..has this been thought about in light of the decision to structure the global scope into to environment records (a object ER for the global object (and var/function declarations) and a declarative ER for let/consts, etc.) Yes, we've thought about this. I don't think it changes much, other than to make the case Mark worried about less prevalent. > Also, aren't free references (to globals) quite similar to imports that can't be satisfied at link time. I can imagine that such free variables could be treated as implicit imports from the global scope and resolved at the same time and in a similar manner to explicit imports. There is something that seems more satisfying about all "linking" errors occurring at the same time rather than some occurring as early errors and others occurring as linking errors. I believe that this may end up being a distinction without a difference. When a module is compiled, the names it imports from other modules must be present, or there's a static error. There's no case where a module is compiled-but-not-linked, and thus I don't think the difference would be observable. > Finally, are there races between an async script block that define modules and subsequent html elements with id attributes. If such a module uses a free global reference to access the DOM node with the matching id won't the occurrence of the compile time error depend upon whether or not the the async script loader gets around to compiler the the script before the html parser gets to the element with the id? There are certainly races here, just the way that: ```html <script async> x </script> ``` races with such dynamic DOM insertions.