Hacker News new | ask | show | jobs
by gizmo686 1992 days ago
At the language level, FP seperates data from behavior. However, in practice, even functional programmers still tend to couple data and behavior.

For instance, not much would change about programming in Haskell if List was defined as an abstract type, so users couldn't see its constructor or interact with it in any way except through its functions.

In OOP languages, this is unambiguous because the function/interface implementation is explicitly defined as part of the type. In FP languages, this is a little less clear because the implementation can be defined anywhere (although, should really be either near the data declaration, or the typeclass declaration).

1 comments

Only really true for the common (bad?) OOP languages, CLOS system in Common Lisp decouples the two and adds multiple dispatch for added spice.