Adam Ruppe Wrote: > On the subject of rebindable, what about: > > const Object o; // not rebindable, the whole thing is set once and const > const(Object) o; // the Object is const, but the reference is not. > > So, everything is rebindable unless the declaration has a > const/immutable on the outside. > > int a; // rebindable (obviously) > const(int) a; // the int never changes... but the variable a might.
int "value" is effectively immutable, it doesn't matter what qualifier you apply to it. The variable can be still reassignable to a different value. > Meaningless for a value type, but makes sense for a reference type > const int a; // the whole thing is set once and never changes. The > const applies to the variable a itself, but the transitive property > propagates it down to the int type too. There is a difference between whether you can assign the whole struct or its distinct members. There was some words about this in the docs.