Hey folks, is there any way to figure out whether a type is immutable or shared given its typeinfo?
Yes: if it is an instance of TypeInfo_Invariant or TypeInfo_Shared.
void main() {
string s;
char[] c;
assert(cast(TypeInfo_Invariant) typeid(s).next !is null);
assert(cast(TypeInfo_Invariant) typeid(c).next is null);
}
The next is there because the array itself isn't immutable, so we
look at the type inside.
