Back
Why is it that they decided to make String immutable in Java and .NET (and some other languages)? Why didn't they make it mutable?
One should really ask, "why should X be mutable?" It's better to default to immutability, because of the benefits already mentioned by Princess Fluff. It should be an exception that something is mutable.
Unfortunately most of the current programming languages default to mutability, but hopefully in the future the default is more on immutablity (see A Wish List for the Next Mainstream Programming Language).
31k questions
32.8k answers
501 comments
693 users