C++ Logo

std-proposals

Advanced search

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

From: Bo Persson <bo_at_[hidden]>
Date: Wed, 14 Dec 2022 10:16:14 +0100
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.

Received on 2022-12-14 09:16:23