Search code examples
dintrospection

How can I restrict user defined attribute application in D?


I want to make a user defined attribute attachable only to the struct/class methods. In Java's annotation there is such option: @Target restricts annotation attach targets. Is there analogue in D?


Solution

  • No, but you could make the processor you write that handles it static assert(0) if it finds it attached to one.