News for hackers. Stuff that matters.
Re:Rust’s async isn’t colored by majewsky on Thursday March 11, 2021 @07:40AM (#26423363)
Instead of

  f2(g(h2()))
you'd write something like

  f2(async { g(h2().await) }).await
if f2 takes a future, or

  f2(g(h2().await)).await
if it takes a value. (The latter is more common.) The equivalent in JS would be

  await f2(g(await h2()))
Re:Rust’s async isn’t colored by pansa2 on Thursday March 11, 2021 @07:59AM (#26423480)
The example uses `g(h2)`, not `g(h2())` - `g` takes the function `h2` as an argument, and the call(s) to `h2` are made from within `g` itself.

If calling `h2` requires an `await` if and only if `h2` is async, then the function `g` can’t be used for both the synchronous and async cases. AFAIK this is the main objection to having two function colours.

Re:Rust’s async isn’t colored by gpderetta on Thursday March 11, 2021 @08:25AM (#26423725)
exactly this. Unless the language allows abstracting over the async/non-async calls.