On Sat, 07 Apr 2012 07:26:26 -0400, deadalnix <[email protected]> wrote:
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 ?
See http://forum.dlang.org/post/[email protected]
I think you should be able to construct it by @attribute'ing a struct.
But this sub-thread is about changing the name of the function for
construction purposes, but keeping the type as the attribute name.
-Steve