Proposal for __traits

davidl davidl at 126.com
Tue Aug 21 23:51:14 PDT 2007


__traits itself is great
though i think adding some builtin properties for class would be nicer

consider

class D
{
     this() { }
     ~this() { }
     void foo() { }
     int foo(int) { return 0; }
}

D.members[] ->  
"_ctor","_dtor","foo","print","toString","toHash","opCmp","opEquals"


myclass.allmembers[] -> "i","j"

class D
{
     this() { }
     ~this() { }
     void foo() { }
     int foo(int) { return 0; }
}

D.allmembers.derived[] -> "_ctor","_dtor","foo"

class D
{
     this() { }
     ~this() { }
     void foo() { }
     int foo(int) { return 2; }
}

D.allmembers.VirtualFunctions[] -> ["foo":void delegate (),"foo":int  
delegate(int)]

getVirtualFunctions could be something developed by meta programming

struct S
{
     int mx;
     static int my;
}

S.members["mx"] = 3;		// this looks nicer, but we need to extend our type  
struct of members, typeof for members is a bit strange

also final functions , abstract functions could be some sub properties



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



More information about the Digitalmars-d mailing list