subscript
にすることで避けられないかと。extension Array { mutating func update(_ modify: (inout Element) throws -> ()) rethrows { for i in 0..<count { try modify(&self[i]) } } } extension ArraySlice { mutating func update(_ modify: (inout Element) throws -> ()) rethrows { for i in startIndex..<endIndex { try modify(&self[i]) } } }