After tweaking dmd a bit litte, i get the dotexp overloading work.

The following is the test code:
import std.stdio;
class c
{

    B opDotExp(char[] methodname,...)
    {
        writefln("god it works ", methodname);
      return new B();
    }
    void opAdd(int j)
    {

    }
    void test()
    {
    }
}

class a:c
{

}

class B
{
  int i;
  B opAssign(int k){
    i=k;
    return this;
  }
}

char[] v1;

void func(char[] v, ...){}

void main()
{
   a v=new a;
   v.test();
   v.dynamicmethod(3,4);
   //v.qq = 5;
   writefln((v.qq = 5).i);
}

it generates the output:
god it works dynamicmethod
god it works qq
5

Any comments? Do you like this feature?

--
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

Reply via email to