|
|
|
|
|
by tav
2608 days ago
|
|
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. |
|
I agree that the syntax should have `await' somewhere, and the observation that it "clearly" is not a field access is actually credible to me. This also open the possibility to have other kinds of postfix keyword e.g. .try or .match