# A final proposal for await syntax

**URL:** <https://internals.rust-lang.org/t/a-final-proposal-for-await-syntax/10021>\
**Category:** language design\
**Created:** [May 6, 2019, 2:36pm UTC](https://internals.rust-lang.org/t/a-final-proposal-for-await-syntax/10021 "2019-05-06T14:36:19Z")\
**Posts on this page:** 1\
**Showing post:** 238

<div class="post-metadata">

**Author:** ![nikomatsakis](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nikomatsakis/32/5410_2.png) [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Post date:** [May 15, 2019, 7:06pm UTC](https://internals.rust-lang.org/t/a-final-proposal-for-await-syntax/10021/238 "2019-05-15T19:06:55Z")

</div>

> [@rpjohnst](#):
>
> So the comparison I’m making here is a bit more nuanced- `await(foo)` is much closer _on the whole_ to the constellation of other syntax, even though it still doesn’t fit perfectly:

I think this is indeed an interesting argument and I think worth adding to some summary (I am trying to create a "master summary", but I've not had time to finish up yet, and I would include it there).

I don't agree with your conclusion, though: let me try to elaborate why. I guess perhaps it's an _uncanny valley_ argument -- to me, having `await(foo)` be _so close_ to other keywords and yet with this critical difference is quite surprising. It differs in two respects:

- It requires a (non-block) delimiters
- It has unusual precedence

That is, `return(foo)?` would be parsed as `return ((foo)?)`. But `await(foo)?` would be parsed as `(await (foo))?`.

That seems bad and quite surprising to me -- more so that `foo.await`. I guess it's like this: `foo.await` feels like something where you might say "oh, that's unusual", but you'd have no real doubt as to when it takes effect. I can't say the same for `await (foo)?`, which I consider quite visibly ambiguous.

If we're going to use mandatory delimiters, then, this leads us to either `await[foo]` -- which to me is quite "foreign", this is not indexing, and indeed shares many of the same concerns as `foo.await` -- or to `await { foo }`. Here, I agree with @Centril that this feels clumsy and verbose, and ... kind of surprising. We don't expect you to "await" a long block of stuff.

I think you can see a similar tension in `unsafe { }` today. The original intention, I believe, was that one would use `unsafe { ... }` on a long block of instructions. But it has become a more prevalent style to push `unsafe { }` down to the actual operation that requires unsafe, and in that case, the `{ }` feel unnatural -- we've kept them because it feels important to be clear about the scope of unsafe (though I'm not sure that's a good argument, I might be inclined to reconsider that point).

---

_[View the full topic](https://internals.rust-lang.org/t/a-final-proposal-for-await-syntax/10021)._
