220 39851 <CAPuuy5dz_N4nwnDrmds=ROEpnUY2jQU4XGcLytxXscB=X36P1g@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Justin Bassett <jbassett271@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: What do we want from named paramaters
Date: Thu, 16 Aug 2018 21:39:06 -0700
Lines: 121
Approved: news@gmane.org
Message-ID: <CAPuuy5dz_N4nwnDrmds=ROEpnUY2jQU4XGcLytxXscB=X36P1g@mail.gmail.com>
References: <1534441498.3721109.1476442920.71D445BF@webmail.messagingengine.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="0000000000007a12a905739a24f2"
X-Trace: blaine.gmane.org 1534480634 27385 195.159.176.226 (17 Aug 2018 04:37:14 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 17 Aug 2018 04:37:14 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5PL3NYWEDBB5VC3HNQKGQECD2ZOWY@isocpp.org Fri Aug 17 06:37:10 2018
Return-path: <std-proposals+bncBC5PL3NYWEDBB5VC3HNQKGQECD2ZOWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f72.google.com ([209.85.218.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5PL3NYWEDBB5VC3HNQKGQECD2ZOWY@isocpp.org>)
	id 1fqWVZ-0006x3-79
	for gclcip-std-proposals@m.gmane.org; Fri, 17 Aug 2018 06:37:09 +0200
Original-Received: by mail-oi0-f72.google.com with SMTP id p11-v6sf6117784oih.17
        for <gclcip-std-proposals@m.gmane.org>; Thu, 16 Aug 2018 21:39:19 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1534480759; cv=pass;
        d=google.com; s=arc-20160816;
        b=ZCl0t4SI4dspwZVEN9FHeYbi/CLGxnC+D3wXp16SJgscQHfVmw4BLGBg68JZTaazL3
         jc0kshr+/dTUGWo/Zta4Q64BqR3aqe08EMtyj0RbcKulhxA3slYbkvR5mE7lILqj2tb6
         mR25onDqeV3YIBuCte/jDtQPclzMgbuD6zkLP+76PVVeFdmLmhnoLqaxKNF81+t+DmgG
         UdBmMX3tWmLywXCOqU5pZyHPFyfDwSDPfbMJvTXnkEKCTiYx285WKe4ubD4lPoUGLq70
         5120PUl52izwo2k0wZmZTc0Ue2VkH+VlO9WufBEZXKKgSsonwaip9DF2npsROM3k7I5n
         a9/A==
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:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=rfebTtl7mxB3T0ZZdWmkdrFzr7saeXyNdmDSuerlv/I=;
        b=BDR3R034XnVMM0XetLeUV36EXG6lVsgWYM466bRuI1cNk3dn6rNw/u8jKB+JzSZhkP
         1ZYb6cr4WIUjTNw/9jSg0QrmOUGQWkvqzKCF1W3xvk8uqb3jWwvd2Rt2Kt2EeZ4W3GoD
         QycPVPXDv13QKUZlETHHo14ySVkANJFa0RmP/OcTfDuk9oJ4zFl6vr9ACYyPi1moP7eU
         C6e5RjP4fvYX9+gOXuQwjG36+HNAIRLy/Kwazv6E8NPM6wDJpBcK2zRe/3wbfHa6NMXQ
         LbLkoESdS9T+5oLJaS+Grf7ZZS9Psenn1N5RbYPDgh23LDf+Ck16Y+l9tP9TqFBmEXp2
         Sj6w==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=oUJnlUz2;
       spf=pass (google.com: domain of jbassett271@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jbassett271@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=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :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=rfebTtl7mxB3T0ZZdWmkdrFzr7saeXyNdmDSuerlv/I=;
        b=CGDYc4a/8HQRFeaki1AssTMR960FIOkHIVqFDORDiaZ0M0/fv7X5UDZOkaSU5Oq7uU
         zXnI+zzaTdREV1gs6PkW+lFM11GkiTWhYPCQU+kG0B0mbX+Yt1kzmn8snGUnpvfpg7qd
         lXAY56/CIW8dfXZEITs/olUVTuCiu1APs66Y+z4z21vWKKdYzyT73jTLf2LNHbBqmp2h
         RPBiem+QTvREqsJLzW0rwLi8RKbwGjI45T6m7kZ4Pp0XRMoH/ck+fBfrze7O8kKsQZaI
         r2vSYuc+gZf/Ze3llmXnOT5TYVzd/m0lqAFCd3AvRBAH9ku1+pbVHLVk+AR6u6TwGo7a
         155g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to: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=rfebTtl7mxB3T0ZZdWmkdrFzr7saeXyNdmDSuerlv/I=;
        b=AhPtOnQC2on+SbkW9PK7yulLAxMSlLMvaiiSBO3Uav6t9Q+MO5gIRcAKGEtIeg7EDX
         /8TT8bUi5FNAWadWiXpPly7Hb+VE5C0ctM1aYrAoSYSJUZwwDnbZuVrOUYv0RXRS6GrV
         pd5AvjeL2ZZyMlQ5ea9d3+NPADRrfISzCEWVz4QXlPmVhPzI4XFWwfXYE+V/N+EDCj43
         vfXxA15nbde3wzp3uVK/7OQOqWQVTxPv7vGv3SZF3sZd82B7lpATN+xsCwdcyNFSeVV5
         tQzQwj9QT8TJVu2Vbi9h64MbYSkCV2dDMIU+o+zR8+z2xPR6xKzJymlTzRhzOXmwtpsH
         iM2A==
X-Gm-Message-State: AOUpUlHAr6iIya9KKtwD+q7a93FzTl//aTTKfDGbPPB5tzIfNh7QrKRP
	4miZcdVBpJ2XlvAjj6d7uDYyvg==
X-Google-Smtp-Source: AA+uWPxmSF3PpjRwQzT1iNnuygAeatsrLizKNN2jpcB5bRkymZT/XoIh5fJ3mloUm3j3PIuW/uSI0Q==
X-Received: by 2002:aca:bd84:: with SMTP id n126-v6mr19052697oif.78.1534480759143;
        Thu, 16 Aug 2018 21:39:19 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:aca:1803:: with SMTP id h3-v6ls3744422oih.13.gmail; Thu, 16
 Aug 2018 21:39:18 -0700 (PDT)
X-Received: by 2002:aca:758c:: with SMTP id q134-v6mr919117oic.334.1534480758211;
        Thu, 16 Aug 2018 21:39:18 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1534480758; cv=none;
        d=google.com; s=arc-20160816;
        b=POJjZaCINnv9KBC9GnfMEFH0yrwykNhG9R5etBMMHyhmcihxoY5RXCIkqNOStIXtf1
         fpQC0dcKWSJe+pU6pczMn6Dw+W1Z5o1SqC87vKpaMye61pXU/R+ol7ZReNWxGbIAujhN
         Sb1UtmxcubXmoKUWUXN6TQ9gReb3dIDnXmsn4UUrpuTiVwakTri5WpbesNagfgXYent/
         kFRubei4bfxKHo8zmE2a/gms5EybUX6jWG99/Q6ZIMqa0ffL7XpaEbarmOUqXaAO8Z8P
         ZpkQNsMrSE6kXnqqv4h9stKWxAFSyR0Zk6B8X/knQZNXmed7/3KVk3LSEpVvi97EVINf
         bztw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=ydWtq0CYtwvTBCZT8fqXaX/oGuyj2tAwvuEy0hp7c+c=;
        b=ibwEvc+J6xQkUBAOMBgMdGXuVwj6TYimk1q8GehggxT2hEe2wPc4pCnChHu/X4t4X9
         oYhPicz+bXWhoO/O6uR9Md9zvY4+zToytM4oLC0y4pH7aHReHkLEcPb0Ua9wdtL/zfOk
         g1JBb+WJtaHUcnQl6Kf7ZVPfRsjltLp4bh+c8SkvPO7Yv6cQNIQfMF6jGMJMUvakNmTQ
         f99OBrpI39NzI5Rl5wHyJpb5HROtd3xn92Iku6bovK9m3dLSfCVCXIQRJFSlR7I7Gzh9
         FrQ3PBNZnOmNS5WgnWl5A+d358Jnsx3GSMQBranLwUKvK28xUh2rMKfMevBd/keHbLNh
         Vo5g==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=oUJnlUz2;
       spf=pass (google.com: domain of jbassett271@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jbassett271@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 p188-v6sor577880oib.146.2018.08.16.21.39.18
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 16 Aug 2018 21:39:18 -0700 (PDT)
Received-SPF: pass (google.com: domain of jbassett271@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:aca:e6cd:: with SMTP id d196-v6mr868608oih.94.1534480757688;
 Thu, 16 Aug 2018 21:39:17 -0700 (PDT)
In-Reply-To: <1534441498.3721109.1476442920.71D445BF@webmail.messagingengine.com>
X-Original-Sender: jbassett271@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=oUJnlUz2;       spf=pass
 (google.com: domain of jbassett271@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=jbassett271@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:39851
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39851>

--0000000000007a12a905739a24f2
Content-Type: text/plain; charset="UTF-8"

On Thu, Aug 16, 2018 at 10:45 AM Henry Miller <hank@millerfarm.com> wrote:

>
> In the past couple months I've seen several proposals for names
> parameters.  Each with a list of pros and cons, and because there are cons
> arguments against them.  I think we need a discussion on what we want
> assuming some strawman acceptable syntax, and some thought of how many
> limitations in corner cases we are willing to accept.
>
> I can think of 4 uses for names parameters. (If you don't understand these
> I have simple code examples)
> 1 . a function with more than one parameter of the same type is called
> with the parameters in the wrong order
>       *  Some people want this to be a compilation error, some want the
> compiler to correct the problem and continue
> 2. a function wants to take the same type to mean different things in
> different contexts
> 3. it isn't obvious from the type alone what a parameter means
> 4. A function has a bunch of defaulted arguments and you want to change
> one of the latter ones without specifying all the others
>
> First question: is this complete?
> Second, which problems are worth solving?
> Third, for problems worth solving, which is the better solution, and how
> strongly attached to it are you?
>

Some other use cases:

5. In tandem with reflection, names could be used for their names. A
formatting library could use this in tandem with reflection:
fmt::format("{sign}
{value}", .sign = "$", .value = 1.34_usd); Language bindings to e.g. Python
could use it to specify names for parameters  (e.g. this could expose the
parameter names to the language bindings: m.def([](int .a, int .b) { return
a + b; }) )
6. This is a variation on 4. There may not be a bunch of defaulted
arguments, but rather a few expert settings which you want the users to be
able to tweak on rare occasions.
7. bool arguments have meaning. It's pretty well known that something
like file.open("path/to/file.txt",
true) is bad, because the bool has no meaning. But
file.open("path/to/file.txt",
..append = true) isn't so bad because the meaning is apparent. Enums
currently fill this role.

-- 
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/CAPuuy5dz_N4nwnDrmds%3DROEpnUY2jQU4XGcLytxXscB%3DX36P1g%40mail.gmail.com.

--0000000000007a12a905739a24f2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Aug 16=
, 2018 at 10:45 AM Henry Miller &lt;<a href=3D"mailto:hank@millerfarm.com">=
hank@millerfarm.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">=
<br>
In the past couple months I&#39;ve seen several proposals for names paramet=
ers.=C2=A0 Each with a list of pros and cons, and because there are cons ar=
guments against them.=C2=A0 I think we need a discussion on what we want as=
suming some strawman acceptable syntax, and some thought of how many limita=
tions in corner cases we are willing to accept. <br>
<br>
I can think of 4 uses for names parameters. (If you don&#39;t understand th=
ese I have simple code examples)<br>
1 . a function with more than one parameter of the same type is called with=
 the parameters in the wrong order<br>
=C2=A0 =C2=A0 =C2=A0 *=C2=A0 Some people want this to be a compilation erro=
r, some want the compiler to correct the problem and continue<br>
2. a function wants to take the same type to mean different things in diffe=
rent contexts<br>
3. it isn&#39;t obvious from the type alone what a parameter means<br>
4. A function has a bunch of defaulted arguments and you want to change one=
 of the latter ones without specifying all the others<br>
<br>
First question: is this complete?<br>
Second, which problems are worth solving?<br>
Third, for problems worth solving, which is the better solution, and how st=
rongly attached to it are you?<br></blockquote><div><br></div><div>Some oth=
er use cases:</div><div><br></div><div>5. In tandem with reflection, names =
could be used for their names. A formatting library could use this in tande=
m with reflection: <font face=3D"monospace, monospace">fmt::format(&quot;{s=
ign} {value}&quot;, .sign =3D &quot;$&quot;, .value =3D 1.34_usd)</font>; L=
anguage bindings to e.g. Python could use it to specify names for parameter=
s=C2=A0=C2=A0(e.g. this could expose the parameter names to the language bi=
ndings: <font face=3D"monospace, monospace">m.def([](int .a, int .b) { retu=
rn a + b; })</font> )</div><div>6. This is a variation on 4. There may not =
be a bunch of defaulted arguments, but rather a few expert settings which y=
ou want the users to be able to tweak on rare occasions.</div><div>7. bool =
arguments have meaning. It&#39;s pretty well known that something like <fon=
t face=3D"monospace, monospace">file.open(&quot;path/to/file.txt&quot;, tru=
e)</font> is bad, because the bool has no meaning. But <font face=3D"monosp=
ace, monospace">file.open(&quot;path/to/file.txt&quot;, .append =3D true)</=
font> isn&#39;t so bad because the meaning is apparent. Enums currently fil=
l this role.</div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAPuuy5dz_N4nwnDrmds%3DROEpnUY2jQU4XG=
cLytxXscB%3DX36P1g%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPuuy5dz_N4n=
wnDrmds%3DROEpnUY2jQU4XGcLytxXscB%3DX36P1g%40mail.gmail.com</a>.<br />

--0000000000007a12a905739a24f2--

.
