4 ms·
Not all functional programming styles emphasise types so much - Lisp-based languages may not even have types at all. To my mind classes conflate several differe
by lmm 1y ago
Not all functional programming styles emphasise types so much - Lisp-based languages may not even have types at all. To my mind classes conflate several different things, and a lot of the benefits of functional style is to unpick those different things and let you approach them separately:
- Basic compound data structures (product types). Most imperative languages don't have sum types, which is the root of a lot of problems in that style
- Interfaces (some more enlightened imperative languages separate these out) and the adapter/impl/typeclass/what-have-you that ties together an implementation of that interface for that datastructure
- Mutable references - some way of associating an identity or name with a value that can be switched for a different value accessed via the same identity/name