const
Janice Caron
caron800 at googlemail.com
Sun Apr 27 23:11:14 PDT 2008
2008/4/27 Bruno Medeiros <brunodomedeiros+spam at com.gmail>:
> > x is still immutable.
>
> Well... in this case yes, but only because it is a basic type. Your
> assertion still does not hold: "it is /impossible/ to declare a const
> variable that isn't, in fact, invariant".
Again, we're on the same page here. I wasn't precise enough. That rule
doesn't hold for all types (as your counterexample shows), it only
holds for types which contain no pointers to mutable data. So I should
have said "it is impossible to declare a const variable of a type
which contains no pointers to mutable data, that isn't itself
immutable". (But I know more now than I knew then, and hindsight is
easy! :-))
More information about the Digitalmars-d
mailing list