User Defined Attributes

Jacob Carlborg doob at me.com
Tue Nov 6 05:57:29 PST 2012


On 2012-11-06 14:17, Adam D. Ruppe wrote:

> We can always use custom types to get this kind of thing.
>
> struct key { string value; }
>
> [key("value")] foo

Right, good point. 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 () {}

enum test = "test";

[test] void foo () {}

Or

struct test {}

[test()] void foo () {}

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list