Hacker News new | ask | show | jobs
by lalaithion 2183 days ago
Functional programming is philosophically aligned with purity and immutability. When you have enforced immutability, many of the features of OO programming disappear, and you're left with having pointers to a bundle of values with various getter style methods. In order to recover the ability to make complex data structures, you need to encode variants. This can be done with Null and the bundle of values, or it can be done with Algebraic Data Types, aka Rust's fancy enums.