Thoughts (mine, yours) on the reference's grammar?

โš“ Rust    ๐Ÿ“… 2025-10-08    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 5      

surdeus

The reference does not distinguish in the grammar whether an expression is value or place; take match for example where scrutinee is just an Expression, but actually it's always a place expression so a value is implicitly converted (assigned to a temporary variable).

I understand that โ€”since value<=>place are converted by rust, users can ignore it. However, the reader eventually finds out that "actually it expects place" or ".... expects value". And this is quite confusing (to me anyways!)

Maybe there is a better place to read the grammar? Though wouldn't it be nice to have it distinguish Place vs Value Expr in there?


I'm aware of the page place and value exprs, which doesn't do the best job although I get this is quite hard to explain briefly and correctly.

For example, this paragraph about Temporaries feels hard, mainly because neither place nor value appears explicitly, i.e the grammar does not show it. (this applies to match, for example).

3 posts - 2 participants

Read full topic

๐Ÿท๏ธ Rust_feed