custom attribute proposal (yeah, another one)

Jacob Carlborg doob at me.com
Sat Apr 7 06:59:27 PDT 2012


On 2012-04-06 19:36, Steven Schveighoffer wrote:
> so now I must define a type for every attribute? I'd rather just define
> a function.
>
> What if I have 20 string attributes, I must define a new attribute type
> for each one? This seems like unneeded bloat.

If we want to be able to pass a key-value list to the attribute, I think 
a struct is needed.

@attribute struct Author
{
     string name;
     string email;
}

@Author(name = "John Doe", email = "john at doe.com") struct Foo {}

BTW, could both structs and functions be allowed?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list