Await Syntax Discussion Summary

Following the universal pipelining idea I wrote two translations to see how combination of prefix await keyword (without curly braces) and pipelining will work on real-life code:

Initially I was strongly in the postfix camp, but if we’ll get such feature I think prefix keyword with an additional await? sugar will be the best option. Out of 39 uses of await, postfix variant was used only 13 times (also on top of that in 5 cases you could use chaining instead of creating temporaries), so in most cases prefix await keyword is really nice to use. And as many have noted such code is quite “natural” to read and has familiarity advantage. While in minor cases pipelining await allows to write a more compact and composable code.

@Cazadorro

We already have a lot of examples where the same algorithm can be written in two or even more ways. For example you can replace many explicit loops with combinator chains, or you can mix combinators and explicit loops. And I don’t see anyone complaining about it. So I don’t think it’s a bad thing to leave some amount of stylistic freedom, assuming that this freedom is result of combination of orthogonal features which play nice with each other. Some may prefer to create more temporaries, others will prefer to write code in a chaining style. And I don’t see how it will become “nightmare for clippy”.

3 Likes