@lizzy@social.vlhl.dev did you know that in Swift, arrays are reference types (so you can have shared references to them), and also internally mutable (so you can always mutate them from everywhere), yet they behave as value types that can never have aliased observed mutability? this is because they are reference automatically reference counted, so that when an array is mutated, it can check the reference count. if there is a single unique reference, Swift can just mutate it in place, but if there is another reference, it will first copy the array's contents into a new array, and make your variable point to the new, copied array. then, it will mutate the newly created array.
this is a scheme called Copy-on-Write, which is more efficient than cloning the array every time you need another copy of it, because you just share a reference to the same array and only pay the cost right before it would be problematic to share the array.
it is commonly abbreviated CoW, which reminds me of how adorable you surely look with that bell fixed to your head like a milky mammal moo moo bitch ❤️ have you considered buying a onesie to match
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
sodiboo (sodiboo@gaysex.cloud)'s status on Sunday, 27-Apr-2025 02:29:50 JST sodiboo