Re:How true hackers write JavaScript
by cyphar on Wednesday September 05, 2018 @07:51AM
(#17917060)
I agree that because of common uses of things like match in Rust it makes it consistent to also do it for functions. I don't agree that the reason why it's consistent is because a function body is an expression (though of course you have more expertise than me on this one -- and Rust does actually treat scopes much more strictly than most other languages so you could argue every scope has the smell of a function call associated with it).
[ Parent
| on HN ]
Re:How true hackers write JavaScript
by steveklabnik on Wednesday September 05, 2018 @09:06AM
(#17917507)
Here's the citation: https://doc.rust-lang.org/reference/items/functions.html
> A function consists of a block, along with a name and a set of parameters.
https://doc.rust-lang.org/reference/expressions/block-expr.h...
> Blocks are always value expressions and evaluate the last expression in value expression context.