Coming from an OOP background, I've got some issues with the concept of immutable objects/records/messages in functional programming.
Lets say I pass an PurchaseOrder record through a pipeline of functions where each function is supposed to add or update data in this record.
When dealing with mutable state, I would simply set some specific properties of the message beeing passed around.
When dealing immutable records, are there some design tricks making things easier on this matter? Copying every single field in order to change just one field is just a pain.
{ A = x.A ; B = x.B ; C = x.C ; D = x.D ; E = somethingnew; }
I guess grouping data as much as possible is a good way to deal with it, thus avoiding to copy all fields. Are there any other ways or design guidelines for this?