A final proposal for await syntax

Further to @comex's point, you might say "Flatten an iterator" but we write iter.flatten().

If we have:

get_client_sme(wlan_svc, iface_id).await?
    .disconnect().await
    .map_err(|e| format_err!("error sending disconnect request: {}", e))

I would read this as:

Get the sme client with the wlan_svc and the iface_id, await it and re-throw, then disconnect and await, and map the error.

I don't think we are sacrificing readability. @scottmcm has made fine points about how .await and ? offers good readability and works well with left-to-right (data-flow order) reading flow.

We also disagree that it is niche. As seen in the code snippet oft cited in this thread, await is followed by . 20 times out of 43, which is 46.5% of the time.

Citation needed?

10 Likes