> However I could probably still agree with you if mutating was also used in 
> classes. What's the point of having it only on structures?

In a regular method, `self` is a regular (constant) parameter, but in a 
`mutating` method, `self` is `inout` so that it can be mutated and those 
mutations will reach the caller's copy of the instance. There's no need for an 
`inout` `self` on reference types, because the mutations are performed on the 
shared instance which both the caller and callee have a reference to, so 
`mutating` only really makes sense for value types.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to