Hacker News new | ask | show | jobs
by grzm 1691 days ago
An aspect of immutability I really appreciate is that I know no variable has been changed after it's been assigned to, including by me. If I want to know where the value was assigned, I only have to look for the only place it could have been assigned. I don't have to search anywhere else.
1 comments

99% of variables are local to your function, is not like program a thousand of global variables.
Sounds like you code pretty tight. I've seen plenty of functions reference variables out of function scope, or be reassigned within long function bodies. I personally don't code that way, but not everyone does. And as you've seen in this thread, there are people that do like immutability. To each his own.
I do prefer immutability too and think it should be the default for most programming, my original point was that for me, the trade-off of using clojure (small ecosystem) instead javascript for single server CRUD apps is not worth it but as a language I'll take clojure over javascript any day.