Are FP and OO orthogonal?

后端 未结 10 1544
-上瘾入骨i
-上瘾入骨i 2020-12-12 10:51

I have heard this time and again, and I am trying to understand and validate the idea that FP and OO are orthogonal.

First of all, what does it mean for 2 concepts t

10条回答
  •  有刺的猬
    2020-12-12 11:51

    The idea of objects can be implemented in an immutable fashion. An example is the book "A Theory of Objects", by Abadi and Cardelli, that aims at formalizing these ideas, and where objects are first given immutable semantics because that makes reasoning about object-oriented programs simpler.

    In this case, a method that would traditionally have modified the object in-place instead returns a new object, while the previous object persists.

提交回复
热议问题