Here, you'll look at how to use immutability in your functions and data types. Immutability helps us to write code that is easier to understand and maintain because it limits the places where things can change.
First, write a function. Then, look at it and determine what it needs to do. Does it just look at the data passed to it? Does it store or return a reference to data passed in? We'll use these facts about how the function uses its arguments to determine the best-fit qualifiers.
The use of
immutable is slightly different on free functions and object methods.
If you are accepting a value type,
immutable aren't very important.
If you are borrowing a value—going ...