3 ms·
Almost all “immutable” types are mutatable by the runtime itself, irrespective of language or environment. A couple of examples of why “immutable” types are ac
by olliej 8y ago
Almost all “immutable” types are mutatable by the runtime itself, irrespective of language or environment.
A couple of examples of why “immutable” types are actually mutable:
* string interning - a string may technically be immutable, but identical strings can be coalesced by the runtime.
* immutable objects are not generally immortal: the runtime will eventually want to free the data, which means it must be mutable by the runtime.
Basically at the runtime level if you forget to check all the correct flags you can easily do the wrong thing.
If you look at the bugzilla report you can see the comment from the apple engineer about needing to fix this particular foot gun.