News for hackers. Stuff that matters.
Re:Go-like channels in 10 lines of JavaScript by gbuk2013 on Saturday February 04, 2023 @06:45PM (#34659737)
Hmm, the way I see it is that this only makes a difference if your "more work" is async, in which case I would consider if the function needed refactoring instead - not possible to say with toy code of course. Something like:

  await makeManifest().then(manifest => Promise.all([moreWork(manifest), compileServer(manifest)]))
If, however, "more work" is synchronous then the promise would not resolve until the next tick which puts you in the same place as before + extra overhead from a pair of extra promises.
Re:Go-like channels in 10 lines of JavaScript by pcattori on Saturday February 04, 2023 @07:33PM (#34660161)
Yep, totally could do that. But I like I mentioned here (https://news.ycombinator.com/item?id=34659597) I wanted to keep the interfaces for `compileBrowser` and `compilerServer` since my mental model for it is that those two are "siblings".