2 ms·
The point is that you don't always want to mark the method as mutating. This is explained in the article.
by yawaramin 11y ago
The point is that you don't always want to mark the method as mutating. This is explained in the article.
- mikeash 11y agoThis is described in the article. I wouldn't say that it's explained. It makes no sense to me. Whether a method mutates state should be evident when you make it. The very concept of a value-type method which mutates state but isn't marked as mutating makes no sense at all. It sounds like it might be a case where you actually wanted reference semantics but accidentally used value semantics and are trying to make it work anyway.