Re:Top-level await in JavaScript is a footgun
by domenicd on Wednesday September 14, 2016 @03:21PM
(#12500367)
And I wish you'd try to engage with me instead of jumping to your usual tone arguments.
Yes, that is indeed what I am referring to, as engines already do for HTML.
Re:Top-level await in JavaScript is a footgun
by rich_harris on Wednesday September 14, 2016 @03:29PM
(#12500431)
When I tried to ask you about this stuff on Twitter the other day, this was your dismissive response: https://twitter.com/domenic/status/774762508091551745
Speculative fetching is possible in HTML because <link> and <img> and <script> tags etc are declarative. Similarly, modules can be fetched without the code executing because `import` is declarative. How can a browser prefetch modules when it encounters an imperative statement like `x = await import(computedModuleId())` without actually running the code?
When you talk about speculative fetches, are you suggesting that engines would guess at which modules were going to be imperatively imported before actually running the code? That doesn't seem like a general solution, or even a particularly desirable one, but I'm interested to learn what you're referring to.