on Tue Aug 09 2016, Fritz Anderson wrote:
> I’m sending directly to those who took time over my question, because, per
> Michael’s request, I have a
> minimal case to attach. Phrases in boldface are for skimmability, not
> shouting.
>
> Strip out my use case (I’m encouraged that Dave recapitu
on Fri Aug 05 2016, Joe Groff wrote:
> Since your backing buffer is copy-on-write, you can do the in-place
> mutation optimization in your immutable implementations, something
> like this:
>
> class C {
> var value: Int
> init(value: Int) { self.value = value }
> }
>
> struct S { var c: C }
Swift 3 as of Xcode 8.0b4
TL;DR: I have a struct value type backed by a copy-on-write mutable buffer. You
use it to perform arithmetic on the buffers. The most expressive way to do this
efficiently is to chain the arithmetic operators so each mutates the same
buffer. Swift does not like to chai
Since your backing buffer is copy-on-write, you can do the in-place mutation
optimization in your immutable implementations, something like this:
class C {
var value: Int
init(value: Int) { self.value = value }
}
struct S { var c: C }
func addInts(x: S, y: S) -> S {
var tmp = x
// Don't
Swift 3 as of Xcode 8.0b4
TL;DR: I have a struct value type backed by a copy-on-write mutable buffer. You
use it to perform arithmetic on the buffers. The most expressive way to do this
efficiently is to chain the arithmetic operators so each mutates the same
buffer. Swift does not like to chai