What is immutability and why should I worry about it?

前端 未结 15 1078
无人共我
无人共我 2020-12-07 09:51

I\'ve read a couple of articles on immutability but still don\'t follow the concept very well.

I made a thread on here recently which mentioned immutability, but as

15条回答
  •  悲哀的现实
    2020-12-07 10:37

    An immutable object is something which you can safely assume isn't going to change; it has the important property that everyone using it can assume they're seeing the same value.

    Immutability usually also means you can think of the object as being a "value", and that there's no effective difference between identical copies of the object and the object itself.

提交回复
热议问题