Invariant doesn't apply to declared symbols

Janice Caron caron800 at googlemail.com
Fri Nov 30 03:13:34 PST 2007


On Nov 30, 2007 11:06 AM, Walter Bright <newshound1 at digitalmars.com> wrote:
> I think this suggestion is over-engineered. It's much simpler to say
> that a declaration, even one with const type, is rebindable unless it
> has a storage class of const.
>
>       const C c;
>       const(C) d;
>
>
>       c = new C: // Error;
>       d = new C; // OK
>       d.x = 100; // Error

I don't necessarily care if you use that particular syntax that I
invented or not. Feel free to invent a better one (although obviously,
I like mine). However, no disrespect intended, but yours is terrible!

C should mean exactly the same thing as (C). "const C" and "const (C)"
should be interchangable.



More information about the Digitalmars-d mailing list