Hacker News new | past | comments | ask | show | jobs | submit login

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 think the ?? can be already used for Result<Result<_,_>,_>.

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


The `!` already means "diverges", I don't love the re-purposing of this here.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: