[Issue 1983] Big Hole in Const System

Janice Caron caron800 at googlemail.com
Thu Apr 10 04:33:25 PDT 2008


>  ------- Comment #1 from fvbommel at wxs.nl  2008-04-10 05:55 -------
>  IMHO the problem here isn't the type of (&a.x) but the fact that it's allowed
>  to compile at all.

Same thing. You just stated the problem differently.

    a.x = 2;

won't compile because a.x is typed const. Wheras

    (&a.x)(2);

will compile because (&a.x) is not typed const. The fact that it
compiles is a /symptom/. We can treat the symptom, but I'd rather
treat the disease. To treat the disease, the type system must allow
types such as

    ReturnType delegate(Params...) const

to exist. Likewise

    ReturnType delegate(Params...) invariant

and eventually, we're even going to need

    ReturnType delegate(Params...) invariant pure

Janice


More information about the Digitalmars-d-bugs mailing list