6 ms·
OO: 'state is hard, let's make it easier by encapsulating it with only the procedures that need to manipulate it' FP: 'state is hard, let's not do it unless we
by narwally 6y ago
OO: 'state is hard, let's make it easier by encapsulating it with only the procedures that need to manipulate it'
FP: 'state is hard, let's not do it unless we absolutely have to'
- munificent 6y agoModern multi-paradigm language: "State is hard. Let's avoid it when we can and encapsulate it in procedures when we can't."
- Weebs 6y agoI think for FP it should be added, that the state is explicit and has a clear owner. Eventually someone has to replace the old value with the new value in the call chain What's really interesting is Rust arrived at a similar destination, I assume as a natural byproduct of pushing for memory+thread safety. State isn't discouraged, but you get explicit owner(s) of data who lend it out to others who are readonly by default, and explicit when they will modify the reference you gave them.
- narwally 6y agoYeah, maybe it's more like "state is hard, so only Paul can do it. If you want to Paul to change some state for you, then you're gonna need to fill out this form."