Avatar
なるほど。 仮にそのような型 (仮に InteriorMutableContainer: IMCとする) を現状の言語機能の範囲で実装するとして、以下のように borrowing 共有による同時編集の問題があるため、exclusive が必要ではないでしょうか struct IMC<X>: ~Copyable { subscript(index: Int) -> Void { // ↓ダミーの嘘実装 get {} borrowing set {} } } func main(_ c: borrowing IMC<Int>) { // borrow は copy しないので non Copyable な値を複製(?)できる proc(c, c) } func proc(_ c1: borrowing IMC<Int>, _ c2: borrowing IMC<Int>) { // 同じメモリの同時読み書き c1[0] = c2[0] } (edited)