Concerns about using struct initializer in UDA?
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 11 03:51:09 PDT 2017
On Thursday, 11 May 2017 at 10:49:58 UTC, Andre Pany wrote:
> 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é
We have that syntax already.
More information about the Digitalmars-d
mailing list