> This one is ... a confusing set of rules. I take it empty loops have an
> implied trailing semi in their body? That is: "while true {}"? I know it's a
> degenerate case, just trying to clarify.

{} is a non-expression block. The phrase 'trailing semicolon' was
badly picked. The deciding factor is whether there is a trailing
expression or not.

> It seems to me a lot of look-behind / look-inside for a parser to be doing,
> in order to disambiguate.

Not really. The two kinds of blocks (expr-block, stmt-block) become
different syntactic elements. The code to decide which is which is
already in the parser.

> This would mean
> 'if foo { a } else { b } - 10'
>  would parse as 2 expr-stmts,

I think this is even worse than the current situation. The 'res'
proposal might be acceptable, but let's please not do this. I think,
though, that with my proposed changes the current approach should work
pretty well, and I like it better than having 'res'. Plus, the main
problem I'm trying to solve here is specifying which elements need a
trailing semicolon in a sane way. That wouldn't be solved by the 'res'
keyword.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to