TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Thoughts on immutability in programming languages?

2 pointsby diegojromeroalmost 4 years ago
I have developed a proof-of-concept Python package to freeze objects [1]<p>I&#x27;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&#x27;t find any. I have some idea of what a functional language is (have developed a bit with Haskell and Erlang), but I&#x27;ve not used them in any job. I suppose that&#x27;s why I can&#x27;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&#x2F;idea&#x2F;feeback&#x2F;criticism or comment on this matter is appreciated.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;diegojromerolopez&#x2F;gelidum" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;diegojromerolopez&#x2F;gelidum</a>

1 comment

aszenalmost 4 years ago
I think immutability isn&#x27;t really a feature with use cases.<p>It&#x27;s a way of programming without modifying data structures in place&#x2F;in memory. It&#x27;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 &quot;The value of values&quot;.<p>Coming back to freezing a python object, the most obvious way to use that is to ensure that the object isn&#x27;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&#x27;s main feature is that it makes concurrency easier, if you have some data that&#x27;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.
评论 #27505303 未加载
评论 #27504168 未加载