3 ms·
> why are "we" all programming in languages with mutable state? My argument is not against closure or using immutable objects. My argument is against trying to
by tybris 17y ago
> why are "we" all programming in languages with mutable state?
My argument is not against closure or using immutable objects. My argument is against trying to rebrand a problem that has been well-known and well-studied for over 40 years.
Clojure does a bit of copying (memory management, not "time management") to force you to avoid concurrency problems that arise in some scenarios. Arguably that is a good thing, because people tend to think of concurrency when it's too late. However, it too ultimately has a mutable authoritative source where the same issues arise. Moreover, the hardest concurrency and consistency problems arise in distributed systems. Using Clojure certainly isn't the answer to that.
> Isn't this the same thing as stubbornly clinging to free and malloc in programs where garbage collection would work just fine?
People "stubbornly clinge" to programming with free and malloc (in C), because it allows them to have very specific control over how their program will behave. This allows you to perform very effective optimizations. Moreover, because it is cumbersome, C programmers will avoid dynamic memory, which will again make your program faster and more durable. The same thing will apply to mutable objects. Clojure simply restricts you to a certain model, which is not necessarily most efficient.
Does that mean Clojure is bad? No it means it's not the right tool for every job.
- loup-vaillant 17y ago> Clojure simply restricts you to a certain model, which is not necessarily most efficient. So does C. You don't use mutable array because they are the best solution. You use them because they're the best supported datastructure in C. Sometimes even when a shared immutable tree would be most efficient. For a well-know, well-studied, and still unsolved problem, rebranding isn't wrong. It's the only way. I think pervasive mutation falls in this category. So does the widespread use of the Qwerty layout.
- drewr 17y agoNo, it's not the right tool for every job. Rich isn't arguing that kernel drivers be written in Clojure. His work addresses the pain he feels -- writing concurrent, high-level applications that model the real world. Also, you'd be amazed at how much control you have over the underlying system in Clojure; you just rarely have to wield it.