I’m almost sure I’ve seen this addressed before, but my intertube search skills have failed me.
i’m looking for something that will let me do:
struct S1 a; b; c end function f1(s::S1, new_b) s(b=new_b) end s2 = f1(s, 5)
i.e., f1 will actually return a new copy of s with the b field updated, i.e. s2 will be a new instance of S1. This allows me to keep struct S1 immutable, and of course not have to type out all of the other fields which are not being updated.
I’m sure i’ll find the post that addressed this approximately 10 minutes after I press “Create Topic”