Re:Is Haskell really the language of geniuses and academia? ...
by zozbot234 on Saturday August 20, 2022 @01:16AM
(#32529311)
Rust supports mutability that's bounded to a single program scope. That's a lot closer to functional immutability than to default-shared mutability as used in most procedural languages. Shared mutability is very clearly opt-in, and usually exceptional.
The lesson I derive from Haskell is that "If it compiles, it will work"
1. is inflated nonsense
2. has a lot less to do with Haskell-the-language than with Haskell-the-type-system
I have observed a similar phenomenon with Rust. That statement is not perfect, it's hyperbole. If it compiles, it doesn't mean it will run (otherwise, why bother writing code? We just write function signatures and call it a day).
But Rust's type system is incredibly sophisticated, just like Haskell's.
And guess what... Rust supports mutability. It doesn't just support it, it encourages it. It tells you "Step over that fence, it's okay, I got your back".
It's so liberating.
The secret here is not functional programming. It's not immutability.
It's a sound and powerful type system.