We hit 50 responses to the poll, so here’s a mini-analysis of the results so far and a runoff poll for those interested.

- “Stick to the status quo” got exactly half of the votes so far. This seems interesting to me, but also means that the idea of a refutable let has some significant support. In hindsight maybe I shouldn’t have included the option, so that half of the respondees could voice which alternative they’d like if we introduce one.
-
let ... elsetook half of the remaining vote (including preceded by<keyword>). This seems by far to be the crowd favorite, even with the grammar ambiguity. If it weren’t for the ambiguity, this would be the obvious choice. - 12% of the vote went to
<keyword> let(includingelse let). Upon further consideration, I think thatunlessin this position could be contextual and only require single-token lookahead;$:ident letis never currently legal code.
So that said, here are the two syntaxes I’d like to runoff:
let ... else match
let Ok(x) = make_x() else match {
Err(e) => {
log!(e);
bail!(e);
}
}
do_something_with(x);
(Requires special-casing an if expression to always greedily consume the else, rather than a fully unambiguous grammar.)
unless let ... match
unless let Ok(x) = make_x() match {
Err(e) => {
log!(e);
bail!(e);
}
}
do_something_with(x);
(Requires a new contextual keyword or using else here which is human-ambiguous.)
let ... elseunless let
0 voters
I’d also like to guage opinion on one other factor before finalizing RFC draft for initial discussion:
- Make the
matchpart optional, infer_ =>for the diverging block - The
matchpart should always be required, just type_ =>if you don’t care about the value
0 voters