DIP 1031--Deprecate Brace-Style Struct Initializers--Community Review Round 1 Discussion
John Colvin
john.loughran.colvin at gmail.com
Sat Feb 15 21:59:26 UTC 2020
On Thursday, 13 February 2020 at 07:29:00 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community
> Review for DIP 1031, "Deprecate Brace-Style Struct
> Initializers":
>
> https://github.com/dlang/DIPs/blob/c0c1c9f9665e0bc1db611f4e93e793d64451f763/DIPs/DIP1031.md
>
> Here in the discussion thread, you are free to discuss anything
> and everything related to the DIP. Express your support or
> opposition, debate alternatives, argue the merits... in other
> words, business as usual.
>
> However, if you have any specific feedback for how to improve
> the the proposal itself, then please post it in the feedback
> thread. The feedback thread will be the source for the review
> summary I write at the end of this review round. I will post a
> link to that thread immediately following this post. Just be
> sure to read and understand the Reviewer Guidelines before
> posting there:
>
> https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md
>
> The review period will end at 11:59 PM ET on February 27, or
> when I make a post declaring it complete. Discussion in this
> thread may continue beyond that point.
>
> At the end of Round 1, if further review is deemed necessary,
> the DIP will be scheduled for another round of Community
> Review. Otherwise, it will be queued for the Final Review and
> Formal Assessment.
>
> Please stay on topic here. I will delete posts that are
> completely off topic.
:(
I really like them and would prefer to have them do more.
So currently I can write this:
struct Q { int b; string c; }
struct S { int a; Q q; }
S s = { a: 3, q: { b: 5, c: "hello" } }
and that's great.
But what I'd really love to be able to do would be this:
S foo()
{
return { a: 3, q: { b: 5, c: "hello" } };
}
and
Tuple!(int, "a", int, "b") bar()
{
return { x: 3, y: 7 };
}
and even
auto bar()
{
return { x: 3, y: 7 };
}
static assert(is(typeof(bar()) == Tuple!(int, "x", int, "y")));
Although probably not lowering to the phobos std.typecons.Tuple
for obvious reasons.
Anonymous structures are great.
More information about the Digitalmars-d
mailing list