It does, over (await e)?
.
expr =
| "await" expr
| expr "?"
| IDENT // Make our grammar terminating.
| "(" expr ")"
;
vs.
expr =
| expr "?"
| expr "." "await"
| IDENT
;
If we want to nitpick, the first grammar requires one more alternative (parenthesis) to express as much as the second one.
I didnât say that adding both await
and await?
makes the grammar simpler. It doesnât, as syntactic sugar never does. But it does provide the semantic compression you mentioned while arguing for e?
and the others.
And Rust already has brackets and fields, so counting the productions in a subset of the grammar doesnât prove anything.
I thought you meant that (await e)?
(without await? e
) requires fewer syntactic forms than e.await?
(not true).
Just new to this discussion, has a â.â + some sigil been mentioned already? For example:
let result = future.!await?;
let result = future.@await?;
let result = future.#await?;
extended to match syntax it will be like:
try {...}.@match {...}
What do you like about the second sigil? It's syntactically unnecessary, but does it have some other advantage?
What do you like about the second sigil? Itâs syntactically unnecessary, but does it have some other advantage?
It just makes mentally and visually much easier to distinguish field access from await, because no field name starts with a sigil. And consider reviewing a diff patch, we don't/can't have syntax highlighting from IDE to help.
For this version of await
I'd suggest to add a space before and after:
let a = get_result_of_future() await ?;
let a = get_result_of_future() await .or_else(|_e| Ok(...))?;
let a = get_result_of_future() await + 7;
I get what youâre saying, but it still feels weird. At that point you might as well do something like:
let a = get_future().(await)?;
let a = get_future().(await).or_else(|_e| Ok(...))?;
let a = get_future().(await) + 7;
It seems unnecessary to me to replace .await
with either of these. I donât see the benefit as being particularly compelling. This might work for postfix function call syntax, thoughâŚ
Final Results
The polls is now closed. You can see the results by clicking the link.
Summary: There have been no substantive percentage changes since my last update. As almost all of the votes were in at that point.
The final approval rank order was:
- Macro style -
await!(future)
- Keyword Prefix -
await future
- Method call style -
future.await()
- Function call style -
await(future)
- All the variation on keyword style (parenthesis, braces, tight binding, ?) in that order.
- Field access style -
future.await
- Field! access style -
future.await!
- Sigils @ followed by #.
When ranking by favorites it is almost the same except that Keyword (prefix) style comes in first. (by a fairly wide margin).
Observations
- People do not want a new sigil. This initially was quite popular with early voters but dropped off rapidly with later voters.
- The prefix style options: Prefix keyword or Macro style are strongly preferred to the postfix style that was supposed to improve upon them. This is reflected in both favorites as well as approval / disapproval percentages.
- The extensions to the keyword syntax to attempt to improve it, such as adding a
try
keyword are much less popular than simply leaving the keyword alone. - The
future.await
syntax proposed by the lang team is very widely disapproved of. Itâs approval percentage has not changed since it was announced as the proposed syntax. It has remained around 75% disapproval since the poll opened.
As noted before. This is not a vote and may well have no effect on the overall outcome. But is here to provide useful feedback to the developers.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.