It depends what language you come from; this is standard in "everything is an expression" langs. Takes some getting used to if it's new!
-
This Tweet is unavailable.
-
-
This Tweet is unavailable.
-
This Tweet is unavailable.
-
This Tweet is unavailable.
-
Replying to @AntonVanMoere @cd0 and
To be clear, "implicit return" is not the semantic. It's that expressions evaluate to their values.
1 reply 0 retweets 0 likes -
Replying to @rustlang @AntonVanMoere and
So, the only way to have early return is with a return keyword, which itself is an expression that has the type !.
1 reply 0 retweets 0 likes -
Replying to @rustlang @AntonVanMoere and
So, a return in tail position is valid because it falls out of normal semantics, it would be less consistent to disallow it...
1 reply 0 retweets 0 likes -
Replying to @rustlang @AntonVanMoere and
... and the only way to get back to consistency would be to disallow the "return" keyword, but then that would really harm readability.
2 replies 0 retweets 0 likes -
Replying to @rustlang @AntonVanMoere and
... as you'd have to contort your code to conform to that style. Some style guidelines for C demand this, but for reasons that don't ...
1 reply 0 retweets 0 likes
... apply to Rust, and I believe I saw a study that shows it's bad for comprehension overall, but I may be mis-remembering.
-
This Tweet is unavailable.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.