Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread Andre Pany via Digitalmars-d
On Friday, 12 May 2017 at 19:33:52 UTC, ag0aep6g wrote: On 05/12/2017 09:01 PM, Andre Pany wrote: [...] [...] [...] [...] [...] You can create the attribute separately: enum Field a = { locationName: "B" }; @a int c; Or if avoiding the extra symbol is more important than

Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread ag0aep6g via Digitalmars-d
On 05/12/2017 09:01 PM, Andre Pany wrote: On Friday, 12 May 2017 at 10:23:34 UTC, Nicholas Wilson wrote: [...] I'm not sure if it isi what you're looking for but you can do struct Field { string location; string locationName; } struct Foo { @Field("","B") int c; } [...]

Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread Andre Pany via Digitalmars-d
On Friday, 12 May 2017 at 10:25:07 UTC, Seb wrote: On Friday, 12 May 2017 at 10:13:02 UTC, Andre Pany wrote: Does it make sense to open a DIP? It would make UDA quite nice to use if you can group several attributes into a struct. Or someone know whether there are already known issues why it

Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread Andre Pany via Digitalmars-d
On Friday, 12 May 2017 at 10:23:34 UTC, Nicholas Wilson wrote: 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

Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread Seb via Digitalmars-d
On Friday, 12 May 2017 at 10:13:02 UTC, Andre Pany wrote: Does it make sense to open a DIP? It would make UDA quite nice to use if you can group several attributes into a struct. Or someone know whether there are already known issues why it isn't possible? The entire point of a DIP is to do

Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread Nicholas Wilson via Digitalmars-d
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

Re: Concerns about using struct initializer in UDA?

2017-05-12 Thread Andre Pany via Digitalmars-d
On Thursday, 11 May 2017 at 11:57:01 UTC, Stefan Koch wrote: On Thursday, 11 May 2017 at 11:36:17 UTC, Andre Pany wrote: On Thursday, 11 May 2017 at 10:51:09 UTC, Stefan Koch wrote: On Thursday, 11 May 2017 at 10:49:58 UTC, Andre Pany wrote: [...] We have that syntax already. I do not

Re: Concerns about using struct initializer in UDA?

2017-05-11 Thread Stefan Koch via Digitalmars-d
On Thursday, 11 May 2017 at 11:36:17 UTC, Andre Pany wrote: On Thursday, 11 May 2017 at 10:51:09 UTC, Stefan Koch wrote: On Thursday, 11 May 2017 at 10:49:58 UTC, Andre Pany wrote: [...] We have that syntax already. I do not understand. Should the syntax I have written already work as I

Re: Concerns about using struct initializer in UDA?

2017-05-11 Thread Andre Pany via Digitalmars-d
On Thursday, 11 May 2017 at 10:51:09 UTC, Stefan Koch wrote: 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

Re: Concerns about using struct initializer in UDA?

2017-05-11 Thread Stefan Koch via Digitalmars-d
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

Concerns about using struct initializer in UDA?

2017-05-11 Thread Andre Pany via Digitalmars-d
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