Jimbob wrote:
"Kagamin" <[email protected]> wrote in message news:[email protected]...
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();

Nice. Is x.opGet overridable?

This is a trick question hinting at the fact that you'd need to define that. I presume it's reasonable to say it is, unless people say

final int x.opGet() { ... }

or something. My point is that when you define new syntax you must add a host of ancillary definitions that reveal how it interacts with the existing language. This problem is obviated by the lowering approach.


Andrei

Reply via email to