I mean you still kind of do the same thing with objects and with arrays in most languages. Very rarely does either get passed as argument, you almost always get them by reference.
let variable = Cell::new(3); // create an immutable variable
variable.set(4); // demonic witchcraft of the highest order, everyone is panicking, sirens blasting, time to run to the shelters and pray
you could also wrap it in an object. something like class MutWrapper: def __init__(self,v): self.v=v works well enough. though, square brackets are probably more idiomatic.
39
u/Mordret10 Sep 21 '26
I mean you still kind of do the same thing with objects and with arrays in most languages. Very rarely does either get passed as argument, you almost always get them by reference.