News for hackers. Stuff that matters.
Re:Local State Is Poison (2012) by Gravityloss on Friday December 27, 2013 @10:46AM (#6971015)
In a way, traditional static memory style C does this.

You can't return locally created variables [beyond primitives].

Beyond simple primitive reading/returning functions, you often create some arrays or structs, then pass a pointer to the necessary arrays and structs to your functions, so it can read and write them.

This way the functions can stay pure.

Re:Local State Is Poison (2012) by chas on Friday December 27, 2013 @09:03PM (#6973532)
Taking pure to mean referentially transparent, I'm not sure I understand your point here. If you are mutating a statically allocated struct or array passed by reference, doesn't that have a very similar effect to global variables? It makes the dependence explicit rather than implicit which is useful, but it is still effectively global state.