220 41171 <b18e4777-8139-2fcb-df71-cb9a560e7472@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Function Parameter of Struct Type -> Named Parameters
Date: Fri, 30 Nov 2018 14:56:50 -0500
Lines: 63
Approved: news@gmane.org
Message-ID: <b18e4777-8139-2fcb-df71-cb9a560e7472@gmail.com>
References: <CAB+4KHLe6zDPRreF2q0zQptUgrO0-_u8VrAOA7Du+_KHxhGUnw@mail.gmail.com>
 <20181129060523.GA21632@noemi.bahnhof.se>
 <CAB+4KHLNKgefS3mn+trH1_Yb1QBi-+8VvdHNos57g1a_8hJ6KQ@mail.gmail.com>
 <20181130020338.GA2787@noemi.bahnhof.se>
 <CAC+0CCPHC7beENi=C0mVcz-cv4tR1w0nejLGp9O8k16i9YC9iQ@mail.gmail.com>
 <CAHSYqdaoV0gxVVGYorLJdnq2OxH6MmjsW7c0_xZM5bkn+yz97A@mail.gmail.com>
 <ddecfa6f-3179-efc6-4787-24708ae516bd@gmail.com>
 <CAHSYqdbC2POmioK6H9Fhq3VAZ5si=0YY3ek=JcPigtMkjsk=WA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1543607688 4584 195.159.176.226 (30 Nov 2018 19:54:48 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 30 Nov 2018 19:54:48 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0
To: Hyman Rosen <hyman.rosen@gmail.com>, std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBBBNMQ3QAKGQEDSE7HHY@isocpp.org Fri Nov 30 20:54:44 2018
Return-path: <std-proposals+bncBC37LBFWUIFBBBNMQ3QAKGQEDSE7HHY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qt1-f199.google.com ([209.85.160.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC37LBFWUIFBBBNMQ3QAKGQEDSE7HHY@isocpp.org>)
	id 1gSos7-000146-V6
	for gclcip-std-proposals@m.gmane.org; Fri, 30 Nov 2018 20:54:44 +0100
Original-Received: by mail-qt1-f199.google.com with SMTP id p24sf6536633qtl.2
        for <gclcip-std-proposals@m.gmane.org>; Fri, 30 Nov 2018 11:56:54 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1543607814; cv=pass;
        d=google.com; s=arc-20160816;
        b=AUo1NBbObWRPrtrPTcTuMpqKdxYYxVoWTpdrQAZT09qnHzYagxoBOyFShy6Qlh/THl
         +nfhg84IgYbJt0mK9qTdCuYfgpr3hEDs5Y/Pqzhabfztx196vqSCPf33uErcNyPU4ew6
         7Mug8FSYFdhWDbVYP3yEPWGqs6V/J9daSc61P6ICZJPfQpnktiaJ+84heo3hLO0Mc0D+
         v3fdGze1JupCHjewajFr7zKPBTvfnVvrJZfK6DbI09uDOnfg8K9ZBZp2YRvvNN2alOn0
         AAXDgm8H5Uy/OhfoEGuqt4QdFM7S5k3BaOyY2WTgm96tRJtDDFq5kNH/pAA6zmCPXh3M
         7ZzQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:mime-version:user-agent:date:message-id:openpgp:from
         :references:to:subject:dkim-signature;
        bh=/0ADm7hXWtLHM+F9G3JbXFx2hEaLkraQFcfOBq6z97A=;
        b=Paf+VV/cg/KDL8KFm9r1f408INdXgXiDJG0gCeN29059majPj6qrJhcW326D4bR4ou
         QOQQoUdf7VGLa94qCm6CARPlfD8CzsEuRXtBP42RHoTqaqHfqjVlFKot3jthEQJjR+wn
         YlF3BowcRH1Nn1M+8W9WUXZkiBXXdzK4N3DZZ+4wv79JAzTgRGA6Wg5ksdNYyA12pC0J
         lQQqDpJUJrLiPJNoznFt/hn850PKFQtkshbseEzUQiGCo4zuoYnnjh6a16tQPeFwNWSM
         qYzET1U/5tcUGX6cOk0iI83LsYLcs8pc2cNDOA4PAlQWde2c3qNQYirmwFd7nbEz9Qf6
         QgiQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b="XMv/DP5D";
       spf=pass (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:openpgp:message-id:date:user-agent
         :mime-version:in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=/0ADm7hXWtLHM+F9G3JbXFx2hEaLkraQFcfOBq6z97A=;
        b=EPPzM2aguAp2yywndN3uRfAQO8H8PXdI8qZ0Zl0k+ctlIL3do5TWBMGl0ksR09JCyl
         S1SGVTmomjCvq1CTt2yVrkjvLiu7RodrO5454HAefAsXGaSWbB1gGeIgXKRJ3lhdujRw
         jIo+FBSTvTT3BTyzrPqyhAw35olYLYxflm3C+yx/byGg/jK7/XuNhAKK1iTzsx2i44Nz
         djsUCIGH7Rb2z62HovAvPVYicCI63JVW4yXtBOvBPvUwYsBUhisUkgIetBMEHjqkzKUB
         AjZm6SsBkyvVtCqlkm5GBn1dFhDJFs7SsO7GZcgpA59y3Y7eV/28ALm90hux1a3GD2Zt
         qNzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:openpgp:message-id
         :date:user-agent:mime-version:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=/0ADm7hXWtLHM+F9G3JbXFx2hEaLkraQFcfOBq6z97A=;
        b=PPAISutiImVhw3oqvJf6BK5kHwZgfb3Eg4EYsPnnGC5LA8Oz+AtIrj2CtlVq4CYiz5
         UQAjd2eSnf2MepmD5/gMF9Jd/TDkeyZ+SADzu1SPEHokiByglZugTrXWuMWPjUzZPZn4
         cECDT26+D9KR/E2Io59k+bQp6kr23CvwcmFlVvXhtx5uvM4TU+7qmn9uGuTiiU4QvbC6
         ZunHSkIBFGkj+OPjfYaKA5/30XALQgRUbvpAcgf85baF/YBDWrCUVU8pbnFodsINqF2h
         4Bzzqu5u6hInd60gNIzPP+HD49A9TKTa4UCXJnCSwWsjitU879lytjuqttrKgmuqJBtS
   
X-Gm-Message-State: AA+aEWb3gfC18RTAyvQszUa4ouLnPr9A1vR1isXJoFrgVWmiyw8jzvxS
	eJP3Z+5XJArbgaLo2+7tWtn9TA==
X-Google-Smtp-Source: AFSGD/UFWBVDV7M2C6D9JgTZL8IozOQb5fnjqTwpDp0FLWDCE/RYlgaLfkw7lk9xompexC8KcrKmMw==
X-Received: by 2002:a0c:b744:: with SMTP id q4mr5097358qve.36.1543607814240;
        Fri, 30 Nov 2018 11:56:54 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a0c:b043:: with SMTP id l3ls3262103qvc.6.gmail; Fri, 30 Nov
 2018 11:56:53 -0800 (PST)
X-Received: by 2002:a0c:c993:: with SMTP id b19mr6540958qvk.126.1543607813396;
        Fri, 30 Nov 2018 11:56:53 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1543607813; cv=none;
        d=google.com; s=arc-20160816;
        b=ESwSUBIGXdUMjpBHG7Eq3fZuM7ek/wnb1LtiEPDbIs7FLmzvdfam8Na4ksdYukZIhV
         MfnSz9cVz95zDXWJe8qKZsVNpIdOOUrqWBtO0nqC8AIlCmjmtA8nhmau6SKFj0iJ3wNC
         ji/XM9YbQSMqB2XBwc4rlZkOXRgiPDtNNgwlPDHxeqDALi9yRpG5oSODDZcXUAEDwudT
         S+xBVLDdndIbNhkqsLELwVKvn2n1hHf6oR24wNRKy+bgs8X3rYSJii63VGdWNNW5N8I7
         TCEZVH1MVjWCHt+oJuE6SIYQoy31Ww0MMKcR6ZG5FE1R+F3bbs7WcO684pUmgITCqgK/
         j9Ag==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:openpgp:from:references:to:subject
         :dkim-signature;
        bh=JtPaS75fzUgLpLz2dAusa6Le/60siARe5bvV8jypjIk=;
        b=Kw+2C5Y4vebGcxLTzw5tbgrOeqipO7MarI6TcNSvGUmMDrKGOVL3pRrrseTgawqtcF
         +5f4rBjcSmTOllDBz0RGZhU1gb4rRAW2J8jacSUbwonhMDGhEJfeKbJPlwwnfPIE77pN
         CqL6/sbJ5CX9Ot13fuI4SOHUjrKY3ZVaFMchKAtxLvyJYVL72HuzmUWn3EzxHNn8pmIz
         PouVwL4qkwrEdwNgzVEEut7latnsZ7/liQJOQ4udGvnqdZkMlIZ6WwlNsw2arVxobkBP
         VtXsMFIMvuVEYVlmpybli1WHhHR3DTCI9VPgOhKPc9n2ORD9VNxam2gBmdb5ktnp92/p
         eVPA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b="XMv/DP5D";
       spf=pass (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id c126sor3485405qkf.86.2018.11.30.11.56.53
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 30 Nov 2018 11:56:53 -0800 (PST)
Received-SPF: pass (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a37:5807:: with SMTP id m7mr6558178qkb.141.1543607812908;
        Fri, 30 Nov 2018 11:56:52 -0800 (PST)
Original-Received: from gryphon.kitware.com (tripoint.kitware.com. [66.194.253.20])
        by smtp.googlemail.com with ESMTPSA id f201sm2756454qke.0.2018.11.30.11.56.50
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 30 Nov 2018 11:56:51 -0800 (PST)
Openpgp: preference=signencrypt
In-Reply-To: <CAHSYqdbC2POmioK6H9Fhq3VAZ5si=0YY3ek=JcPigtMkjsk=WA@mail.gmail.com>
Content-Language: en-US
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b="XMv/DP5D";       spf=pass
 (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:41171
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/41171>

On 30/11/2018 14.10, Hyman Rosen wrote:
> On Fri, Nov 30, 2018 at 2:01 PM Matthew Woehlke wrote:
>> On 30/11/2018 11.05, Hyman Rosen wrote:
>>> Named arguments (in my preferred and correct Ada style) are handled by
>>> the compiler without any ABI or mangling changes needed.  You cannot
>>> overload based only on different parameter names.
>>
>> Let's say you have this feature implemented in such manner. How do you
>> make this (not) work:
>>
>>   int foo(int: a, int: b);
>>   std::invoke(foo, .a=5, .c=12); // should be an error
> 
> In my version of named argument association, the std::invoke function
> would need to have at least three parameters, two of which are named
> a and b.  The std::invoke call is not a function call of foo, so the
> parameter names of foo are irrelevant.
Riiiight... So, what you're saying, is forwarding named arguments
doesn't work. That's a shame. It's also a feature that some people
(myself included) want.

Forwarding named arguments Just Works when names are part of the type
(e.g. P1229).

> I'm not sure what you're getting at here. 

Really? std::invoke (and I mean *std::invoke*; I didn't chose that by
accident) transparently forwards its arguments to some other function,
also given in the call site. On its own, it takes whatever arguments you
give it, and just passes them along.

Therefore, it seems "obvious" that I should a) be able to pass named
arguments to std::invoke, and b) that std::invoke should call the
function passed to it using those named arguments. That is:

  int foo(int: a, int: b);
  std::invoke(foo, .a=5, .c=12);

....should result in a compile error, because I am trying to call `foo`
with non-matching arguments. More particularly, the above should have
the exact same effect as:

  foo(.a=5, .c=12);

....which I believe pretty much all of us agree should be a compile error.

I should be able to do something similar with std::apply. More
generally, if I write something like:

  auto t = std::make_tuple(12, .x=7);

....then `t` should continue to "know" that its second element isn't just
an `int`, but one with the 'name' "x".

-- 
Matthew

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/b18e4777-8139-2fcb-df71-cb9a560e7472%40gmail.com.

.
