It makes the code icky and hard to debug, and you can simply return new immutable objects for every state change.

EDIT: why not just create a new object and reassign variable to point to the new object

  • @DerArzt
    link
    31 day ago

    For all the people in this thread talking about the inefficiencies of immutability, they may find this talk by Rich Hickey (the creator of clojure) interesting. Not so much as it shows that they’re wrong, but more so that it’s a good lecture explaining how we can build immutable data structures that address the limitations immutability in a way that reduces the overhead.