custom attribute proposal (yeah, another one)

deadalnix deadalnix at gmail.com
Sat Apr 7 04:26:26 PDT 2012


Le 06/04/2012 22:46, Mafi a écrit :
>> Also, if I see:
>>
>> @square(5) int foo();
>>
>> How do I know that I have to use __traits(getAttribute, foo, Area)?
>>
>> Another possibility:
>>
>> @attribute Area area(int w, int h) { return Area(w, h);}
>> @attribute Area area(Area a) { return a;}
>>
>> Area square(int a) { return Area(a, a);}
>>
>> @area(5, 5) int foo();
>> @area(square(5)) int bar();
>>
>> -Steve
>
> The second possibility looks good. Especially because the lack of
> @attribute on square disallows @square.
>
> Mafi

This is adding code just for the pleasure of adding more code. Why wan't 
I construct Area directly as attribute ?


More information about the Digitalmars-d mailing list