I have developed a proof-of-concept Python package to freeze objects [1]<p>I've developed it for the fun of doing it, without any useful use-case in mind, and to tell you all the truth, I can't find any. I have some idea of what a functional language is (have developed a bit with Haskell and Erlang), but I've not used them in any job. I suppose that's why I can't find a way to use this package to solve any real issue.<p>What are some sources to learn about immutability on programing languages? How could you use a freeze package in Python or other languages? Would it be useful to share information between threads?<p>Any advice/idea/feeback/criticism or comment on this matter is appreciated.<p>[1] <a href="https://github.com/diegojromerolopez/gelidum" rel="nofollow">https://github.com/diegojromerolopez/gelidum</a>
I think immutability isn't really a feature with use cases.<p>It's a way of programming without modifying data structures in place/in memory. It's also enables us to retain old values by generating new ones without modifying them.
To learn the value of immutability, I suggest watch rich hickeys talk titled "The value of values".<p>Coming back to freezing a python object, the most obvious way to use that is to ensure that the object isn't modified by another function when passing it around, this may not seem like a feature at small scale but when working it large code bases it absolutely is.<p>Immutability's main feature is that it makes concurrency easier, if you have some data that's immutable, you can share it freely and everyone can read from it and is guaranteed to get a consistent view of the data without placing any locks or synchronisation.