Hacker News new | ask | show | jobs
by pistoleer 606 days ago
> In Go or Rust, returning an error is also a “color” that spreads out to the top of the call stack.

That's wrong... Suppose A calls B and B returns a Result<T> (so it's colored as you say). A can match both the Some() and the Err() variants of B and return something other than the error in the latter case. So A can shed the color. There is no way to "shed" async-ness like that in javascript.

1 comments

> There is no way to "shed" async-ness like that in javascript.

In rust you can simply call `block_on` and call it a day. In JS there isn't such a construct by default because the blocking the thread would freeze the app, but it exists in every other language with async/await that I'm aware of.