I think this only works when A is already writable without copy in the current scope already. i.e.
function A = test(A) A *= 5; A += 1; end
A = test(A);
will allocate a duplicate of A, I think. The idea is that in this case
A = test(temporary(A))
will remove A from the scope of the caller and transport it into the function's
scope and mark it as writable so that the multiplication
doesn't cause A to be duplicated.