Thoughts on Value Semantics
Value semantics is obviously a super deep topic and I’m certain a lot smarter people have thought about it more deeply than I can, but I just need to get a couple thoughts off my chest. I’ve been thinking about it on and off since Swift introduced me to value types/semantics!
Since this is a short document about a huge topic, I’m just going to restrict it to thinking about two problems that seem related and possible solutions.
- Arbitrary value semantic data structures
- Relocatable (trivially-serializable) data structures (https://www.youtube.com/watch?v=FPUBjPYBsGI)
(I also think that looking at value semantics through the lens of these two problems also leads to a more general way of looking at value semantics.)