On Thu, 16 Jun 2011 22:12:49 -0400, bearophile <bearophileh...@lycos.com> wrote:

Claudiu Verdes:

What am I doing wrong? TDPL has a very similar example...

I think this TDPL example is not good. And generally inout is not fully implemented in D yet.

Yes, a better example would be:


class A
{
        ref inout(int) val() inout
        {
                return _val;
        }
        private int _val;
}

inout is only relevant if the data type being returned has a reference in it, because a value-only type is implicitly castable to any constancy (const, immutable, or mutable).

As bearophile says, inout is not properly implemented yet.

-Steve

Reply via email to