3 ms·
Everything at the function level that isn't `let` is an expression. And that `let` is not an expression is just an aspect of Rust that reduces boilerplate and r
by tatterdemalion 11y ago
Everything at the function level that isn't `let` is an expression. And that `let` is not an expression is just an aspect of Rust that reduces boilerplate and rightward drift; the block containing those three statements in your example is still an expression which evaluates to the same thing as the Haskell below.
The original commenter seems to mean 'purely functional' rather than 'expression based'. OCaml uses `let in`, but still has side effects.
- CuriousSkeptic 11y agoPerhaps a better world would be referentially transparent. Thought I'd avoid a debate about what constitute functional. But here we are...
- tatterdemalion 11y agoThe issue you're talking about is purity (not having side effects). Many expression based languages have side effects, such as Rust, OCaml, or Common Lisp.