4 ms·
The author cites immutability as a large concern for using Scala. Immutability is pretty easy in Scala - use vals (like final in Java) and persistent datastruct
by joshhart 16y ago
The author cites immutability as a large concern for using Scala. Immutability is pretty easy in Scala - use vals (like final in Java) and persistent datastructures (which have the same API as mutable objects), so I don't think this is a valid concern. Almost everything I write is immutable.
I'm not very familiar with Erlang, but I thought mutability was pretty easy to achieve there. Maybe it's the messages that have to be immutable? Could someone clarify?
- chops 16y agoThe closest thing Erlang has to mutability is the process dictionary (get() and set()), which can be thought of as a sort of memcache for each process. Native variables themselves are immutable, without exception. Unless you have a really good reason, using the process dictionary is generally frowned upon.
- rvirding 16y agoWhile the dictionary itself is mutable the data in it, both keys and values, is immutable like all data in Erlang. It is the same with ETS tables which behave more or less like processes, the data in them is also immutable.
- rickmode 16y agoImmutability being possible is not the same as mutability being impossible (or the rare exception that is dealt with in a special manner). His point is that since in Scala mutability is possible (and indeed is idiomatic) you run into concurrency concerns.