Concerns about using struct initializer in UDA?

Andre Pany via Digitalmars-d digitalmars-d at puremagic.com
Thu May 11 03:49:58 PDT 2017


Hi,

I know there are concerns about struct initialization in method 
calls but what is about struct initializer in UDA?

Scenario: I want to set several UDA values. At the moment I have 
to create for each value a structure with exactly 1 field. But it 
would be quite nice if I could use struct initialization to group 
these values:

struct Field
{
	string location;
	string locationName;
}

struct Foo
{
	@A = {locationName: "B"} int c; // <------------------
}

void main() {}

Of course the syntax is questionable, it is just a proposal.
What do you think?

Kind regards
André


More information about the Digitalmars-d mailing list