[idea] Mutable pointee/ RCString

2016-02-07 Thread Iakh via Digitalmars-d
Is it hard to make pointee data mutable? E.g. if have: -- struct RCString { private char[] data; private @mutable int* counter; } -- So for optimiser (in case of immutable) this looks like -- struct RCString { private char[] data; private @mutable void* counter; // poin

Re: [idea] Mutable pointee/ RCString

2016-02-07 Thread Iakh via Digitalmars-d
On Sunday, 7 February 2016 at 14:00:24 UTC, Iakh wrote: Explanations: As far as "immutable" transitive: -- immutable RCString str; *str.counter++; // Impossible/error/undefined behavior(with const cast) -- Language defines immutable to do some optimizations based on true constness of st