User Defined Attributes

Walter Bright newshound2 at digitalmars.com
Tue Nov 6 07:15:06 PST 2012


On 11/6/2012 5:57 AM, Jacob Carlborg wrote:
> But I would still like to somehow be able to name an
> attribute. If one just need to mark a symbol, i.e.
>
> @test void foo () {}
>
> Then one either have to use a string literal or something like a dummy
> variable/type.
>
> ["test"] void foo () {}

Which does exactly what you ask for.


> enum test = "test";
>
> [test] void foo () {}

or:

    enum EEE;
    [EEE] void foo() { }



More information about the Digitalmars-d-announce mailing list