One caveat though, is that inout
that replaces the storage could cause a problem.
func foo(_ value: inout Matrix<Int>) {
value = newMatrix
}
var a = ...
foo(&a[...]) // Now `a` lost its storage after `yield`.
If that happens, when the we will lost the original storage since the yielding value is the only one that has it.
And I couldn't figure it out a way to avoid both copying and have it work with this. Maybe _modify
could be changed to work during the proposal.