Fully dynamic d by opDotExp overloading

davidl davidl at nospam.org
Fri Apr 17 00:04:23 PDT 2009


在 Fri, 17 Apr 2009 14:52:30 +0800,Don <nospam at nospam.com> 写道:

> davidl wrote:
>> After tweaking dmd a bit litte, i get the dotexp overloading work.
>>  class c
>> {
>>      B opDotExp(char[] methodname,...)
>>     {
>>         writefln("god it works ", methodname);
>>       return new B();
>>     }
>
>> it generates the output:
>> god it works dynamicmethod
>> god it works qq
>> 5
>>  Any comments? Do you like this feature?
>
> That's very impressive. How did you do it? Are the syntax and semantic  
> passes still independent?

Yes, it follows the rule of rewriting the c.unknownmethod(args) to  
c.opDotExp("unknownmethod", args);

Though it currently gets bugs of not supporting struct, opDotExp signiture  
must be (char[],...), and possibly break extension method. These should  
all be fixable.

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



More information about the Digitalmars-d mailing list