With that definition if I make a type with all the interesting methods being impure, it would count as a type with value semantics :(
class Ref<T> {
var value: T
init(value: T) { self.value = value }
}
struct T {
private var ref = Ref(value: 0)
func impureFunc() -> Int {
ref.value += 1
return ref.value
}
}
// doesn't count, this func isn't pure
func f(_ arg: inout T) -> Int {
return arg.impureFunc()
}
// doesn't count, doesn't change when you pass in `a`
func f(_ arg: inout T) -> Int {
return 0
}