2 ms·
> Like, in Ruby, where everything truly is an expression, importing a file and then evaluating it has side effects. In the context of ML, I think it's a more u
by int_19h 2y ago
> Like, in Ruby, where everything truly is an expression, importing a file and then evaluating it has side effects.
In the context of ML, I think it's a more useful baseline. So declarations are still declarations, but e.g. ; is just a sequential evaluation operator.
> let being a statement is nice because it means it can only happen at the "top level" of a block, and not say, inside a loop condition.
I would argue that it's actually a downside - it means that a loop condition cannot have common subexpressions (that nevertheless need to be evaluated on every iteration) factored out.
- steveklabnik 2y agoI guess if you required ; after all of them, sure. Rust doesn’t, so I didn’t think of that. I’ve always found code that does this to be more complicated to read and understand than rewriting it in a different way. YMMV, of course.