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

Can you point to anything other than saying "this is obvious"?


No, just experience with a lot of codebases.

Here's a simple question to ask yourself: what if non-IO operations allowed you to use the .then() syntax? If you have the choice to use:

   1 + 1.then(function(result) { ... }
vs

   const result = 1 + 1
Which would you choose?


Using then() doesn't pause execution of the callsite function, while await does. Surely that's a relevant difference here?

It doesn't seem unreasonable to use then() to express: "Run this anonymous function whenever the async thing completes. Meanwhile let's do this other stuff right now."


Both codebases can't do anything until `result` has a value.




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

Search: