On Thursday, 8 November 2012 at 12:42:38 UTC, Jacob Carlborg wrote:
On 2012-11-08 10:08, Max Samukha wrote:

Could you explain why it is impossible without complicating the current state of things? I gave it a quick try and it seems to work reasonably well (a proper implementation will be more involved due to compiler bugs
and language issues irrelevant to this discussion):

I just see no point in allowing random structs and classes acting like attributes.

Suddenly someone starts to use your struct as an attribute without you having any intention of it acting like an attribute and you don't know about it.

The problem is where to draw the line. There is nothing to stop an idiot programmer from applying your attributes to a wrong target, so we'd better take care of that by introducing those target-restricting attributes specially treated by the compiler.

Instead of throwing attributes on attributes, I'd rather have decorators based on templates as someone proposed. Those would allow the programmer to implement arbitrary restrictions on their usage.

Reply via email to