this document has always claimed that
foo = foo.map{ ... } // foo:Array<T>
is worse than a loop that assigns each element in foo
because of copies produced by the COW system.
Sometimes COW can introduce additional unexpected copies if the user is not careful. An example of this is attempting to perform mutation via object-reassignment in functions. In Swift, all parameters are passed in at +1, i.e. the parameters are retained before a callsite, and then are released at the end of the callee.
But didn’t the calling convention change to +0 or something? Is there still a point in writing in-place map
or whatever?