Re:Classes are a way of writing higher order functions
by Weebs on Wednesday September 09, 2020 @03:27PM
(#24424835)
I 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.
Re:Classes are a way of writing higher order functions
by narwally on Thursday September 10, 2020 @02:17PM
(#24435029)
Yeah, 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."
Re:Classes are a way of writing higher order functions
by munificent on Wednesday September 09, 2020 @01:31PM
(#24423451)
Modern multi-paradigm language: "State is hard. Let's avoid it when we can and encapsulate it in procedures when we can't."
FP: 'state is hard, let's not do it unless we absolutely have to'