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

I think promises are a inner platform in Rust and JS, due to the function coloring problem. They are a different world that you can't escape from. In the async book from Rust [1]:

> Asynchronous and synchronous code cannot always be combined freely. For instance, you can't directly call an async function from a sync function.

Same with JavaScript from [2]:

> The await operator is used to wait for a Promise. It can only be used inside an async function within regular JavaScript code; however it can be used on its own with JavaScript modules.

In JS, the promise world is a different world. Exceptions won't work like they usually do for example.

[1]: https://rust-lang.github.io/async-book/01_getting_started/03...

[2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...



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

Search: