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.

➡️ Stable 0.6x Programming Languages
2,310
Comments
20
Years Active
5
Top Authors
#6257
Topic ID

Activity Over Time

2007
2
2008
9
2009
55
2010
32
2011
46
2012
57
2013
115
2014
123
2015
144
2016
128
2017
163
2018
111
2019
147
2020
269
2021
204
2022
173
2023
168
2024
160
2025
191
2026
13

Keywords

e.g GOTO IMHO OP OOP FP i.e API UI JVM mutable state global mutability mutation fp shared variables data mutate

Sample Comments

Jasper_ Mar 10, 2020 View on HN

What's wrong with mutability?

gf000 Feb 19, 2025 View on HN

So global mutable state? How wonderfully modern!

AsymetricCom Oct 8, 2013 View on HN

maybe shared state is the mistake. mutability is kind of a physical law.

gosub Jul 2, 2016 View on HN

If only we had a way to deal with state without it being mutable...

ww520 Oct 14, 2011 View on HN

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?

atilaneves Jan 9, 2019 View on HN

The usual problems with making things mutable: that mutable state is the root of all evil.

dnaquin Feb 26, 2009 View on HN

well. it's mutable. your code can change it. don't do it (often). then you're just programming with lots of global state.

edjrage Jun 29, 2019 View on HN

because something something mutable state

thom Jul 31, 2020 View on HN

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).

seanwilson Apr 4, 2018 View on HN

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.