On why await shouldn't be a method

Oh, well that's an entirely different argument, then! I was only arguing against trait methods.

I don't have a problem with people who prefer the .await() syntax.

But none of that is true:

  • .await does not auto-deref, and .await() wouldn't auto-deref either.

  • Field syntax can run arbitrary user code and can block.

  • .await does introduce a branch into the surface control flow.

    It must do this because the async fn returns a Future, and the Future's poll method must return to the Executor. It cannot synchronously block.

    Thus, when a .await happens in the code, there is an implicit return (just like ?), and an implicit loop.

It's fine to prefer the .await() syntax, but you should do it for the right reasons, not based on misinformation.

How is that any different from saying that ? creates a return which is invisible to the surface control flow? In both cases they're creating implicit returns.

To be clear, the "blocking" that an .await does is very different from the normal synchronous blocking (e.g. synchronous I/O).

It's different both from a mental standpoint, and also very different from an implementation standpoint.

Rust likes to make the programmer aware of low-level details, so of course Rust makes a distinction between synchronous and asynchronous blocking. Just like how it makes a distinction between the stack and heap.

Niko wrote a couple very good summary posts in the "A final proposal for await syntax" thread:

There's also a lot of other information floating around, but it's mostly in the actual discussion threads (which happened months ago, and covered essentially every possible option, and all the pros and cons of every option):