Idiomatic Rust favors Functional or Imperative Style?

Just as Bruce Lee practiced Jeet Kune Do, the style of all styles, Rust is not bound to any one paradigm.

Instead of trying to put it into an existing box, it's best to just feel it out. Rust isn't Haskell and it's not C. It has aspects in common with each and it has traits unique to itself.

One particularly-interesting facet of Rust is that you can program imperatively with some of the same benefits as functional programming, because of immutability by default, and because of mutability aliasing checking. You can have efficient, imperative data structures which are as safe to use as immutable structures. In some ways this is more work than the equivalent functional code, and safer than the equivalent imperative code. Whether it's worth it depends.

15 Likes