DEV Community

Discussion on: Have you tried functional programming?

Collapse
 
hamidb80 profile image
Hamid Bluri

I dont rhink Rust is functional

Collapse
 
totally_chase profile image
Phantz

I think it's fair to say rust is imperatively functional. As opposed to declaratively functional. The combination of expression-oriented design, traits (clearly inspired by haskell's typeclasses), a strong focus on safety and minimal mutability, strong typing principles (Optional, Result and such safety oriented control flow encoders - also inspired from haskell), highly efficient iterators which makes them usable in regular control flow (much like haskell) - all of this screams functional programming to me.

Though this isn't super special. Throughout the last decade, these very same concepts have been picked up by many modern languages and adopted by older mainstream languages. But since rust started out with all of this - I think it'd be fair to call rust a part of the functional family.

Collapse
 
madza profile image
Madza

Thanks for clarifying ๐Ÿ‘๐Ÿ˜‰

Collapse
 
peerreynders profile image
peerreynders

Rust is at the core an imperative language.

However unlike most imperative languages Rust is largely expression based (conditional operator vs. ifโ€ฆelse) - this makes it possible to leverage a lot more "functional tactics" in a highly effective manner ("zero cost abstractions") than in other imperative languages.

Collapse
 
madza profile image
Madza

Thanks for the share, this is insightful ๐Ÿ‘๐Ÿ˜‰

Collapse
 
madza profile image
Madza

Thanks for the heads up ๐Ÿ˜‰
I will leave that for the readers to decide ๐Ÿ˜‰