3 ms·
Are imports async by default in Deno? That seems to be how it works given that you can import from a URL. This is interesting since async imports are currentl
by ravenstine 7y ago
Are imports async by default in Deno? That seems to be how it works given that you can import from a URL. This is interesting since async imports are currently a part of JavaScript(or at least a proposal?) by using the `import()` function.
- snek 7y agothere are no "async" or "sync" imports in js. there are static and dynamic imports. An implementation is free to spend as much time as it likes between parsing a file to get the static imports and actually running the file doing whatever it likes, including fetching urls, reading the file system, etc. dynamic imports return a promise but the implementation is free to resolve that promise immediately (e.g. `return Promise.resolve(loadSync(module))`)
- ravenstine 7y agoI suppose that makes sense since loading a module from a file on a disk isn't all that different from loading a file over a TCP connection.