January 2020
Intermediate to advanced
532 pages
13h 31m
English
Composite types are by default immutable. This means that their fields are not changeable after the object is created. Immutability is a good thing as it eliminates surprises when system behavior changes unexpectedly because of data modification. We can easily prove that the concrete Stock type that we created in the last section is immutable:

That's great! Now, the immutability guarantee actually stops at the field level. If the type contains a field and the field's own type is mutable, then changing the underlying data is allowed. Let's try a different example by creating a new composite type called BasketOfStocks, which is ...
Read now
Unlock full access