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

That wasn't the reason promises were introduced. An XMLHttpRequest can be synchronous which is Bad™ and that is something explicitly not allowed by the Promise/A+ spec which means it will never be something that fetch() could do. The advantage of promises is that they can be `await`ed in the context of an `async` function which takes a lot of the cognitive load off of the developer.


Furthermore the `await` syntax is one of the reasons why cancelable promises is contentious.

There's no easy way to "cancel" an awaited promise without basically resorting to the .then() syntax.




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

Search: