As per the title: The Julia manual for 1.0 explicitly says that “As in Java, strings are immutable”. And experimentally, I indeed can’t seem to modify a string (other than perhaps using some unsafe
function, but of course if one really insists on shooting oneself into the foot, then one usually can, so I’ll not mind that). Anyway, despite all this, isimmutable("abc")
still returns false – why?
I am kinda hoping this is a bug, but if not, I’d really like to understand what’s going on, and perhaps the documentation can then be improved to clarify this.
While I am at it, to quote some more documentation, this time for isimmutable
:
Return true iff value v is immutable. See Mutable Composite Types for a discussion of immutability. Note that this function works on values, so if you give it a type, it will tell you that a value of DataType is mutable.
I don’t quite understand the very end of this: “… it will tell you that a value of DataType is mutable.” Perhaps this is meant to be say something close to “… it will tell you whether instances of this type are mutable”, or perhaps “… then for a DataType, it will tell you whether instances of that type are mutable, even though the type object itself is immutable”. Is that correct? If not, what else is meant?