3 ms·
Structure and Interpretation of Computer Programs section 3.1, Assignment and Local State, gives an overview of the costs and benefits of adding the concept of
by easeout 3y ago
Structure and Interpretation of Computer Programs section 3.1, Assignment and Local State, gives an overview of the costs and benefits of adding the concept of mutation to an otherwise referentially transparent language. It's from the opposite perspective: we know functional programming, now what's so great and so dangerous about imperative?
http://sarabander.github.io/sicp/html/3_002e1.xhtml http://sarabander.github.io/sicp/html/3_002e1.xhtml
- hinkley 3y agoA lot of people in the imperative world have learned that it’s much easier to test pure functions, and many more people know how badly global shared state affects scalability on the human factors side (everything, everywhere, has access to changes this variable, so good luck figuring out why it gets a bad value). Functional core, imperative shell is the compromise where you collect state in shallow parts of the code, where they are easier to spot and thus easier to reason (correctly) about.