user-defined types are planned, which would give us structs with methods on them. Elembic is a package that simulates custom types, but more in the “styling custom elements” sense, less in the “general purpose structs” sense.
However, custom types would not automatically give us mutating methods (or functions). I actually proposed wished for this here:
One reaction was
@ensko fancy stuff, but I dread the idea of having to read and understand such code
I largely agree, although limiting this feature to custom types similar to what arrays and dicts do may be enough to make it simple enough to understand. The really important point from my perspective is that there really isn’t too much going on semantically; it can be all put in terms of a simple syntactic sugar, and tackled independently once we have custom types.
For now, you can take suiji as inspiration and write code in the “explicitly return the modified struct” fashion if you want/need to avoid state/context.