Mutable State Debate
Cluster focuses on debates about the problems of mutable state, especially shared or global mutable state causing bugs, versus benefits of immutability and pure functions in programming.
Activity Over Time
Top Contributors
Keywords
Sample Comments
What's wrong with mutability?
So global mutable state? How wonderfully modern!
maybe shared state is the mistake. mutability is kind of a physical law.
If only we had a way to deal with state without it being mutable...
Can you give some specific examples of bugs stemming from mismanagement of mutable state? Some examples on bugs resulted from the failure to coordinate state changes or poorly-designed state changes? And how the immutable data solve the problems?
The usual problems with making things mutable: that mutable state is the root of all evil.
well. it's mutable. your code can change it. don't do it (often). then you're just programming with lots of global state.
because something something mutable state
I'm not sure you're responding directly to the point the parent made. Even if state is encapsulated, objects are mutable. Many people believe reasoning about programs in which lots of mutable objects coordinate is harder than some of the alternatives (e.g. pure functions, immutable data etc).
What's the rational behind non-shared mutable state being good? State is a huge source of bugs even if you're just using it locally in my opinion.