On Monday, 23 July 2018 at 16:26:42 UTC, Seb wrote:
tl;dr: the currently proposed syntax options are:


---
struct S
{
    int a = 2, b = 4, c = 6;
}
void foo()
{
    bar(S({c: 10})); // Option 1
    bar(S(c: 10));   // Option 2
    bar(S{c: 10});   // Option 3
}
---

So the struct-initialization DIP has been stalled for too long and I think it's time we finally get this story done. I personally prefer option 2, but this might be in conflict to named arguments which we hopefully see in the near future too. Hence, I'm leaning forward to proposing Option 1 as the recommended Option for the DIP (that's also what the PoC DMD PR implements). What's your take on this?

DIP: https://github.com/dlang/DIPs/pull/71
Rendered view: https://github.com/wilzbach/DIPs/blob/struct-initialization/DIPs/DIP1xxx-sw.md

I also prefer option 3. From a readability point of view it is the most pleasant one (my personal opinion). I also like it due to the already existing struct initialization syntax I am using a lot.

Kind regards
Andre

Reply via email to