On 2013-02-13 09:49, Daniel Kozak wrote:
Hi all,

I play with structs and UDAs today, and I found out some limitation:

struct Entity
{
     string name;
}

void main(string[] args)
{
   Entity entity = {name : "Name"}; // static initialization by name
   auto entity2 = Entity(); // default initialization
   auto entity3 = {name : "Name"}; // should be nice to have

How would this work. What if there's another struct in scope that has the same member(s)?

   auto entity4 = Entity(name : "Name"); // and this would be useful
too. Eg.: for UDAs @Entity(name : "EntityName")
}


Check my proposal for anonymous structs:

http://forum.dlang.org/thread/[email protected]#post-kfbnuc:241cro:241:40digitalmars.com

--
/Jacob Carlborg

Reply via email to