I actually use a small extension for optionals to mutate them when the underlying value is CoW. It takes an inout closure for the underlying value type and a default value if the optional is nil. If there already is a value (which I find out via a switch statement), I ensure that before applying the inout closure I first set self to nil. After mutating the now uniquely referenced CoW value, I assign the result back to self.
Am I correct in understanding that this copy-on-write only happens when there's more than one thing pointing to the (lets say,) array? And that if X is the only thing pointing to the array, modifying X won't cause this problem? The talk was great! Thanks Cory for giving it and Paul for putting on the event
Yes, you understood correctly. I'm suggesting you to take a look at old wwdc talk about value types(probably 2016). In that talk, they implementing CoW manually.
There's a reason why all reliable software in the world is written in C or C++. All these indirections and abstractions you end up having to know about cyclic references, copy on write anomalies and (lack of) compiler optimizations. And the result is unmaintainable code that's impossible to debug if you didn't write the compiler yourself.
Watch next: An Illustrated History of Easter Eggs - ruclips.net/video/fAaqSr-yShc/видео.html
Questions? Comments? Tweet me @twostraws.
I actually use a small extension for optionals to mutate them when the underlying value is CoW. It takes an inout closure for the underlying value type and a default value if the optional is nil. If there already is a value (which I find out via a switch statement), I ensure that before applying the inout closure I first set self to nil. After mutating the now uniquely referenced CoW value, I assign the result back to self.
Awesome! very interesting how swift treats value types... i'm pretty new to Mac development in general and really learned something here!
Excellent presentation, intelligent and clearly explained. Code optimisation is so often sacrificed to rapid release cycles. Thank you Cory!
Ha, small world! Curious to see you here Mark. :) Hope you're doing well.
Really liking the styling of the slides, very "Appley"
Am I correct in understanding that this copy-on-write only happens when there's more than one thing pointing to the (lets say,) array? And that if X is the only thing pointing to the array, modifying X won't cause this problem?
The talk was great! Thanks Cory for giving it and Paul for putting on the event
Yes, you understood correctly. I'm suggesting you to take a look at old wwdc talk about value types(probably 2016). In that talk, they implementing CoW manually.
That was a good talk, for me at least. I must admit that I didn’t understand that 3 option. Is it explained more carefully somewhere else?
Will there be a link for the accidental quadratic? Or is it the one on tumblr? Was he referring to a specific blog post?
Really interesting talk, but I feel that it should be at least twice long.
Now I really want to know the CoW jokes.
Mentions SwiftUI Web @ 12:39
There's a reason why all reliable software in the world is written in C or C++. All these indirections and abstractions you end up having to know about cyclic references, copy on write anomalies and (lack of) compiler optimizations. And the result is unmaintainable code that's impossible to debug if you didn't write the compiler yourself.
SECURITY