Mutating Function on Class Type (Possible bug?)

We could allow it, sure. But it would only change this reference, not any other references pointing to the same object, and not having mutating doesn't prevent you from changing stored properties (see Avoiding unbreakable reference cycle with value types and closures? - #17 by jrose). So it's left out of the language to avoid introducing a point of confusion.

Have you come across a situation where you would have wanted this?

1 Like