Unification and extension of compile-time reflection

Denis Koroskin 2korden at gmail.com
Tue Nov 25 08:07:38 PST 2008


On Tue, 25 Nov 2008 16:42:55 +0300, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> Jarrett,
>
> I agree with most of what you are saying, except for this:
>
> "Jarrett Billingsley" wrote
>> Secondly - the type properties are cute but they're not very flexible.
>> They can interfere with fields and methods, and so the compiler has
>> to explicitly check that aggregate member names don't step on the
>> built-in property names.  I think that "T.prop" could just be replaced
>> with "traits(prop, T)".  traits(min, int), and so on.  Yes, it's
>> longer - but that's what templates are for, if you really want it
>> shorter: Min!(int).
>
> Ugh!  Can we just change traits to not use the functional style?
>
> I like as others have suggested:
>
> C.traits.isVirtualMethod(foo);
>

What is foo in this context? If it is a function (C.foo) then I like  
"C.foo.traits.isVirtual" better, i.e. each member has its own set of  
traits:

class C
{
     int i;
     double d;
     void foo() {}
}

auto si = C.i.traits.offsetof;
auto di = C.d.traits.init;
auto fv = C.foo.traits.isVirtual;
auto fv2 = C.traits.methods[0].isVirtual;



More information about the Digitalmars-d mailing list