Brian Di Palma (2014-10-08T12:11:53.000Z)
domenic at domenicdenicola.com (2014-10-15T18:58:06.553Z)
Thanks for the response and explanations. I didn't realize how limited in power these fast parsers actually were, they are basically lexers. So yes this would require more bookkeeping on their part and that would impact performance. I'm doubtful that it would have a significant user perceivable effect though. I imagine modern browser engines perform a lot of work in parallel where they can. It would seem that the network would be far slower then the engine parsing JS. None the less I understand the concerns. One way around having an impact on current workloads is to only parse in this fashion for modules. This should mean no impact on existing code bases and the impact will only be felt with native modules. Those would rely on HTTP2, Server Push, Resource Hinting so they will tend toward smaller files. If you are shipping native modules then you couldn't bundle into a large module. As these modules would be stand alone fast parsing should be embarrassingly parallel. Lets be optimistic and say that in 5 years developers will be able to roll out native modules. I don't think that in 5 years a shortage of cores will be a problem, even on mobile devices. Given how slowly older IEs are being replaced on enterprise desktops it maybe 7 years... This is all conjecture on my part of course... Yes hoisting is another complication, more bookkeeping, it will probably delay when an error can be raised. But would you not have to deal with it anyway? Can you not export a hoisted function? The module system has to do binding checks on what it exports so keeping track of hoisted functions might have to happen anyway. Modules would end up being slower to parse then scripts but modules are for large scale development. I'm not sure in the grand scheme of things it will be that relevant though. Especially when weighted against increased static reasoning of modules. Fully closed modules are as you said are probably too tedious - that can be dropped. It's more about making modules closed against user defined state as opposed to system defined state. I think that will flow very well with the module system. ```js import * as global, {myGlobalFunction} from "@global"; ``` Should be enough to allow easy upgrading from ES5 scripts while still allowing the module system/tooling to provide more static guarantees.