3 ms·
All control flow mechanisms except await have their own statement: if, for, while, match. Howcome await is different? The dot await syntax might hide an await
by childintime 7y ago
All control flow mechanisms except await have their own statement: if, for, while, match. Howcome await is different?
The dot await syntax might hide an await within an expression, as "just another method". You'll need to hunt it down.
I feel await has costs and consequences that need to be explicit. The dot syntax does the opposite, and therefore I feel Rust might be making a mistake of a lifetime (pun intended) on this one.
- kibwen 7y ago> All control flow mechanisms except await have their own statement: if, for, while, match. Howcome await is different? The dot await syntax might hide an await within an expression, as "just another method". You'll need to hunt it down. Not quite; Rust is an expression-favoring language, so `if`, `match`, and even the `loop` keyword can all appear deep within expressions (the first two do so somewhat commonly; the latter is comparatively rare). In addition, the error-handling operator `?` is also used within expressions. (And while we're on the topic, let's remember that even C, a statement-heavy language, also has `?` as a control-flow operator that is not in statement position.)