This is probably the simplest definition that I found.
- immutable
- adj. 1. (of an object) Having components that cannot be modified once the object has been created. 2. (of a class) An immutable class is a class all of whose objects are immutable. [annotate]
It means that when you do something like
A=(1 2 3) ; where (1 2 3) is an imutable list of integers 1, 2 and 3
We can't say swap the element 2 for a 4 because it is imutable. Some languages allow you to replace the list like
A=(4 5 6), In Erlang you can't once it is assigned you can't change it.
Links:
Java theory and practice - To mutate or not to mutate
Immutable object
No comments:
Post a Comment