© Kit Eason 2018
Kit EasonStylish F#https://doi.org/10.1007/978-1-4842-4000-7_5

5. Immutability and Mutation

Kit Eason1 
(1)
Farnham, Surrey, UK
 

Nothing is so painful to the human mind as a great and sudden change.

—Mary Wollstonecraft Shelley, from the novel Frankenstein

These Folks Are Crazy!

Most software developers, for most of the history of programming, have been entirely comfortable with mutation. Code that uses mutation declares a variable (perhaps with some initial value, perhaps uninitialized), then updates its value one or more times until some final result is achieved. It’s so natural of an approach (at least for those of us who came to programming via languages such as BASIC, JavaScript, and C) that we didn’t really feel the need to ...

Get Stylish F#: Crafting Elegant Functional Code for .NET and .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.