Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


there 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))`)


I 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: