4 ms·
> when every data structure is COPIED on every function call Swift structs use copy on write, so they aren’t actually copied on every function call.
by sumuyuda 8mo ago
> when every data structure is COPIED on every function call
Swift structs use copy on write, so they aren’t actually copied on every function call.
- Epskampie 8mo agoThey are, as far as "Have one source of truth" is concerned. That is what parent is talking about.
- amomchilov 8mo agoThey don’t, by default. That’s something you have to implement yourself. It’s a common misconception that comes from the standard library data structures, which almost all do implement CoW