I'm trying to figure out how worlds based on current modules ecosystem would work ...
```js let path = require('path'), lib = require(path.join(__dirname, 'lib/index.js')) ; ``` How even in an ES2015 world would that look like? Putting async/await everywhere doesn't seem like a real answer ... or does it? On Sun, Dec 20, 2015 at 10:07 PM, Fabrício Matté <ultco...@gmail.com> wrote: > On Sun, Dec 20, 2015 at 7:32 PM, <br...@mailed.me.uk> wrote: > >> there is no reason to create an async function to invoke another async >> function; one can simply invoke it, and if the result/completion is >> required, use it's ,then() member....but there's no need/advantage to >> wrapping such an invocation in an IIAFE, right? > > > I believe the advantage is that you can then replace the > `.then(onFulfilled, onRejected)` constructs with `await/try/catch`, thus > simplifying the code and improving readability. I recognize this may be an > uncommon pattern though, as most often the caller of an async function will > be an async function as well. Note that I say "uncommon" referring to async > IIFEs inside non-async functions; async IIFEs are still very useful to > parallelize sequences of async operations as I've mentioned before. > > Btw, the term "IIAFE" should probably be avoided, as the "A" can > ambiguously mean "Arrow" or "Async". > > /fm >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss