new DIP5: Properties 2

Jimbob jim at bob.com
Tue Jul 28 10:57:55 PDT 2009


"Kagamin" <spam at here.lot> wrote in message 
news:h4jq11$1jvq$1 at digitalmars.com...
> http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP5
>
> As namespaces were proposed, a variant of them is in DIP5 now.

Why not just..

class Foo
{
private:
     int mx;
public:
     int x.opGet() { return mx; }
     void x.opSet(int i) { mx = i; }
     void x.opInc() { mx++; }
}

or instead...

class Foo
{
private:
     int mx;
public:
     int x:opGet() { return mx; }
     void x:opSet(int i) { mx = i; }
     void x:opInc() { mx++; }
}

So that

foo.x++;

Would be compiled as

foo.x.opInc();

In the same way

foo++;

Would is compiled as

foo.opInc();





More information about the Digitalmars-d mailing list