4 ms·
Immutability is kind of an overrated fad. The world is very much mutable. I want to see how languages manage mutability. Languages that provide simple mechan
by ww520 12y ago
Immutability is kind of an overrated fad. The world is very much mutable. I want to see how languages manage mutability. Languages that provide simple mechanisms and tools to manage mutability go a long way to help the programmers to cope with the real problems.
- gavinking 12y agoMutability is a great tool; it dramatically simplifies certain algorithms, and dramatically improves performance of others. But it comes at a cost, and there are situations in which it is inappropriate. So the language should force you to think before reaching for this tool. It shouldn't be the default tool for every problem.
- frowaway001 12y ago> The world is very much mutable. LOL, what?
- deleted 12y ago[deleted]
- jkrems 12y agoDepending on your concept of time, it very much is. If you choose the same abstraction of time for reasoning about the program state and the real world, the same "reference" might change its properties over time. The speed of a car is mutable over time. The question is if the way we reason about time when talking about the "real" world is appropriate for reasoning about time in programs.
- frowaway001 12y agoYes, you mention it. Time. Time is a real property just like IO, effects, values and types. If people stop hand-waving, we would have fewer bugs.
- davidrusu 12y agoAttach a date stamp to your references and facts and BOOM, everything is immutable!
- sitharus 12y agoImmutability is an excellent tool to manage mutability. It lets you make guarantees about what won't change, which allows for some really great optimisations - like safe cross-thread reads without locks. I agree it's not right for everything, but there are a lot of operations that can be modelled with immutable data, such as most server-side web code - reads definitely, and a lot of the write operations don't actually need to mutate objects though most ORMs and other DB APIs do require this.
- Spendar89 12y ago> The world is very much mutable This depends on your definition of "the world". If time and memory are taken into account, you could easily make the case that the world is very much immutable. For example, if your friend changes his email address, its not as if his old address no longer exists. Even if it only exists in memory, it still exists somewhere, and you're still able to reference it. If you're interested in this topic, I highly recommend Rich Hickey's talk "The Value of Values"[1]. [1] http://www.infoq.com/presentations/Value-Values http://www.infoq.com/presentations/Value-Values.
- seanmcdirmid 12y agoIn that case, the reference is still mutable even if the email address isn't. One may also delete an account; i.e. you can change the state of something. A language should set clear boundaries on what is mutable or not, and I see both FP and IP languages going with extreme boundaries in either direction.