Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How would functional programming help with Rust? I am fluent in both, and having map and reduce in the Iterator trait does not make Rust anything like a functional language.


IMO Rust is what you'd get if you took a functional lang designer and forced them at gunpoint to create a procedural systems lang. It's not functional, but you can tell it was largely inspired by ideas from the paradigm -- immutable by default, expression-centric to an extent, features like Option<T> and Result<T> available, etc.

It's certainly a language that encourages programming in a functional flavor, even if the lang itself isn't functional.


The things that make rust “functional” are features like a type system that supports sum and product types and functions as typed values that can be passed around. It really is a functional language (in the original ML sense of the word) but with another orthogonal type system bolted on (borrow checker).

It’s missing some features like higher kinded types but it’s functional nonetheless.

I’m interested to hear what your definition of functional is - it’s always interesting because it’s such a vague term, really.


Jeez downvoters - just look at the definition of “functional language”

https://en.m.wikipedia.org/wiki/Functional_programming

And then tell me Rust is _not_ those things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: