Brian Di Palma (2014-10-08T16:28:56.000Z)
domenic at domenicdenicola.com (2014-10-15T19:00:10.701Z)
Sorry, I meant free variables inside the module. The reason why I originally started this thread was to ask if importing global references or the global would be a way of adding static checks of free variables in modules. You are right that you can't check properties of the global. Hence the suggestions to either import the global and require module code to prepend "global" before accessing global properties. ```js import global from "@global"; global.myGlobalFunction(); //may not exist just like normal global code. ``` In this case only "global" is checked for existence so this should not require special logic in the module system. The other suggestion was to process an import global as a special module which does not have any binding checks performed on it. ```js import {myGlobalFunction, MyPolyfilledConstructor} from "@global"; myGlobalFunction(); //may not exist just like normal global code. ``` Either of the two approaches allows an easy upgrade path for ES5 code to ES6 modules and should allow the introduction of a ban on free variables in modules. I was curious if a ban on free variables in modules was worth considering and any of the approaches outlined above were feasible.