User Defined Attributes

David Nadlinger see at klickverbot.at
Fri Nov 16 13:04:29 PST 2012


On Friday, 16 November 2012 at 13:12:34 UTC, Tove wrote:
> On Friday, 16 November 2012 at 10:41:44 UTC, Walter Bright 
> wrote:
>> The whole point of my example was no, you do not necessarily 
>> know the meaning of a user-defined type that is used as an 
>> attribute.
>
> Agree. Imagine we have 3 generic libs/modules...
> "Optimized CTFE Polygon Primitive Lib", Math, Gfx
> ... and then the "end user", creates a program.
>
> Both Math and Gfx, want to use the optimized Polygon in their 
> modules...
>
> [Polygon(...)]
> struct SpaceShip
> {
> }
>
> This is just as ambiguous as if you had used a built-in 
> int:s... and it can be solved in the exact same way which I 
> outlined in the other thread.

I don't think this is a valid argument. I challenge you to find a 
single real-world use case where an *annotation* would be so 
complex that this would make any sense at all, yet it would be 
impossible (or even just less clear) to just use a wrapper type 
like @CollisionShape(Polygon(…)) or @RenderBounds(Polygon(…)).

David


More information about the Digitalmars-d-announce mailing list