How to fix the pain of modifying Kotlin nested data classes

When Kotlin arrived a few years ago one of the selling points was immutability: In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created. https://en.wikipedia.org/wiki/Immutable_object This is very cool! Value objects are such a huge help when it comes to reasoning about code, safety and avoiding weird subtle misbehaviours due to “things…