In-place mutation of an enum associated value

It would be possible to design a solution where you can pattern match on an enum and capture the associated value as an inout value. This would also require rethinking how indirect enum cases work. Right now the indirect box is essentially passed as a reference type, and the fact that it is immutable preserves value semantics. If the associated value of an enum could be mutated, we would need to perform copy-on-write when projecting the contents of the box instead.

14 Likes