Comment

Comment by tav

In the off chance that some Rust developers are looking at this thread, I'd like to put forward a counter-proposal:

1. Use a postfix ?! instead of .await

2. Use a postfix ?? instead of .await?

3. Use the await keyword only in the "for await" construct

Then the common case becomes:

    let resp = http::get(url)??.to_string()
Which, imo, is a bit easier to parse than:

    let resp = http::get(url).await?.to_string()
This would make it easier to follow the core logic in async code, the same way that ? made error handling so much cleaner in Rust.
parent tav 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton