C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Designated initializers without braces (aka keyword arguments)

From: Gašper Ažman <gasper.azman_at_[hidden]>
Date: Wed, 14 Dec 2022 09:37:03 +0000
Also see historical discussion on how to generically forward such
keyword-arg packs.

Designated initializers don't have this problem, they can't be out of order
and the rules for missing ones are the same as for omitted member
initializers.

On Wed, Dec 14, 2022, 09:16 Bo Persson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 2022-12-14 at 03:13, Ivan Matek via Std-Proposals wrote:
> >
> >
> > On Tue, Dec 13, 2022 at 11:53 PM Andrew Tomazos via Std-Proposals
> > <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
>
> > wrote:
> >
> > On Wed, Dec 14, 2022 at 9:13 AM Kyle Knoepfel via Std-Proposals
> > <std-proposals_at_[hidden]
> > <mailto:std-proposals_at_[hidden]>> wrote:
> >
> > auto value = value_at(.x=1, .y=2);
> >
> >
> > I think that syntax should be reserved for a future designated
> > arguments feature. See D2288R0 here:
> >
> https://docs.google.com/document/d/14sQA95BVz8F7y-tqXxqXiRENvEusn8MzZgoBXMu4UbI
> <
> https://docs.google.com/document/d/14sQA95BVz8F7y-tqXxqXiRENvEusn8MzZgoBXMu4UbI
> >
> >
> >
> > I have not been following this discussion, but from an outsider point of
> > view:
> > . screams member access, not sure why would you want dot in a function
> > argument syntax. Again I am open to being wrong, this is my reaction
> > after reading proposal for 2 minutes. :)
> >
>
> You need *something* to make it different from existing syntax, like
>
> int x;
> f(x = 1);
>
> which assigns to x, while *also* usind x as the parameter. We are cursed
> by having odd syntax already.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2022-12-14 09:37:15