The main ideas of immutability are kept the same throughout the scope of OOP and functional programming or do, for example, Java and Python have their own versions of immutability. More specifically do the following hold in all languages?
- Mutable Objects: Set, Dict, List
- Immutable Objects: Bool, Int, Float, String, Tuple
- In python two immutable objects with the same value also have the same id, two references one value.
- In python again two mutable objects with the same value don't share the same id, two references two values.
Does this idea of two references binding together in mutable objects hold in all languages? And the reverse as well, that is, bindings cannot be changed, meaning that references can only change the value they are pointing to.
i = {1,2,3} # Set, a mutable object j = {1,2,3} i is j False i = j j.remove(3) i is j True
I'm asking because for example in scripting languages objects are passed by references (in other languages passed by value or in C where we have both) so doesn't this change the whole notion of immutability?