Rather than yet another thread pushing a new syntax, I would like to re-broach the topic of whether the initial plan of
await actually needs fixing at all.
I have spent a lot of time looking at each solution proposed over the last few days, and have come to the conclusion that there are more negatives in them than leaving the syntax as it was originally planned (at least for the time being).
// previous, without ? let value = await future; let value = await my_async_function(); // previous, with ? let value = (await future)?; let value = (await my_async_function())?; // new, without ? let value = future.await; let value = my_async_function().await; // new, with ? let value = future.await?; let value = my_async_function().await?;
Based on the above, my conclusion is that there is a slight marginal improvement when using
? with the new syntax, which comes at the cost of a worsened syntax when not using
?. Given that it’s debatable whether there is improvement at all (see other threads for those arguments), I claim that the new syntax is actually not a net improvement and that we should therefore keep the original plan for the time being.
In order to enable the new syntax in future, I propose that although it’s dropped from the initial so-called “MVP” implementation of async/await, it is instead introduced in a more general “Postfix Keyword” feature in future when all other supported keywords also receive a postfix implementation. This should satisfy both those who want the new syntax and those who do not, and it’s actually more consistent because it will be like any other keyword and have both a postfix and non-postfix version.
I have written in more detail here for those interested; I wanted to keep it more concise for the forums.