220 39855 <698e2fea-a733-33b5-282b-b033fe8b9167@wanadoo.fr> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: What do we want from named paramaters
Date: Fri, 17 Aug 2018 11:33:43 +0200
Lines: 212
Approved: news@gmane.org
Message-ID: <698e2fea-a733-33b5-282b-b033fe8b9167@wanadoo.fr>
References: <1534441498.3721109.1476442920.71D445BF@webmail.messagingengine.com>
 <CAPuuy5dz_N4nwnDrmds=ROEpnUY2jQU4XGcLytxXscB=X36P1g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------48E4F9F6805358635CA35F0A"
X-Trace: blaine.gmane.org 1534498303 30792 195.159.176.226 (17 Aug 2018 09:31:43 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 17 Aug 2018 09:31:43 +0000 (UTC)
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0)
 Gecko/20100101 Thunderbird/52.9.1
To: std-proposals@isocpp.org, Justin Bassett <jbassett271@gmail.com>
Original-X-From: std-proposals+bncBDH67CONY4PBB6NM3LNQKGQEEF5RIMY@isocpp.org Fri Aug 17 11:31:39 2018
Return-path: <std-proposals+bncBDH67CONY4PBB6NM3LNQKGQEEF5RIMY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f72.google.com ([74.125.82.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDH67CONY4PBB6NM3LNQKGQEEF5RIMY@isocpp.org>)
	id 1fqb6V-0007q1-A9
	for gclcip-std-proposals@m.gmane.org; Fri, 17 Aug 2018 11:31:35 +0200
Original-Received: by mail-wm0-f72.google.com with SMTP id s25-v6sf727352wmh.1
        for <gclcip-std-proposals@m.gmane.org>; Fri, 17 Aug 2018 02:33:46 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1534498425; cv=pass;
        d=google.com; s=arc-20160816;
        b=KXOhWX71d9CivC7L6j0w5zwcLs4ishGvIvRKAKwiUPbIpSxkWEPs37hayt1wfEVOaT
         euzPsmxynJ9H/AwgRSIBagCdwG/suEwNnV7TiLSoLe5p6w1/U11LjqjnIRMALvOI1Yf0
         cRR2h+ibcVMu1xBHbnEuK/7dGvzmSm7tZDPaDYFyraIq9NdYx5AugS6dPrNtCg1bhAvx
         Uitihe2Z3usOSJzKh6VvhvCrsU7X/tyMr2/wVnoSAh3YP083DYcVwNHF2HYrznNsTrwp
         Hd2P3V615b6ur0YgAJnwu8ivKHdKifFXzEwPxGJFYaOu8Wv86Sm9kOzh6ytE3FMwGl8L
         8a0w==
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:from:references
         :to:subject:arc-authentication-results:arc-message-signature
         :dkim-signature:arc-authentication-results;
        bh=cB+Ol02bn/TbhO0RTuL5/IS+PaHVvslfZSs1pBmOVj8=;
        b=TiKcZdlxWnrdurimHRlZiZrdjTL1+z633+2aj435/cFoJUx9+vaLR82nEHwBoV0VA0
         Kb41Cli+1IqC97IscSJBfTNmsjtHQx7ZxOlOtqoPlZWT8iUU6OUixYw/OFKSU2V3jAYp
         B3RY1PqPEF9+1fbY2Jj0W837AdgIxq2EpBVKoYTojR6jU8R1GLCeTLJGpOEXx4bHghsd
         YMAVUqQezZ5nIr0VCfjFy/A71fpCAQ9t9meGJSWU7ytBis+8JTu4hj28mNX1QJI5h7QA
         eyNjhMvkJpvWhDSPhpbt1wsEhGTXyxMY8UZZWMS++Uv86OXGjgOnpPEataX3yQCzdPjj
         ucsw==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) smtp.mailfrom=vicente.botet@wanadoo.fr
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from: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=cB+Ol02bn/TbhO0RTuL5/IS+PaHVvslfZSs1pBmOVj8=;
        b=UsnN2seae8qtExAyQUlHRVLRqgL07d4mHXcwtsG5IpKE9yGe4cb8xMFhxKBCn3m9Zy
         yi99CZxdp5//BXEYRpL6uonCGgGSpeUoez64NVucTHDIw1Nv83xtEshD1CfwMbiX367u
         sE334Xq+jls5WcvELg1OVF8tTviLlQZozWoXFxuyI7dIPsTtq6Oi2adTPfQb11BTjgCv
         a5BlkXnq0KNo4fRe/8syyi3ba9XLy9rXxqsBL8HSs5T/k+BIttwCi/pXQ4r2POCfAaIL
         /nRc45DNwJm6F2LwjUVfacWUr0+0AYCgMl1qrvStYnu+AqQlkxo3TGxrLNhLFrpP4yg9
         yYFw==
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: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=cB+Ol02bn/TbhO0RTuL5/IS+PaHVvslfZSs1pBmOVj8=;
        b=M88deZzqhoCj92rKO0SFYIWjIkyEml4mcLqvdD6CdIhpgCBzdij/Gh9fwj/O3uEusX
         rob528dJ8l18Wke+hY6h8o4Ib/iZR69TCg2cwCFfHgz6HQ1ZhEsZvHZCtxhJjvfmnlgw
         yrSpTk+hVnvWLUJe71abqCTXDyqUc0201pKL4YB5iJ0U2k6uezp2+pOOGSmIOAdChJCq
         uJNjpyW+fiQhmxcKGH4OxKbmvG+RC/6Y36PW+7rUf9qOWJRGOrxcw7t/bfLig73c076g
         JGR8eyH/uS1BBHWLzcSr1oe/O9Yqzvbaf7VKm1uASaqyYK1x27pVId0tzdvUZTB7G8yY
         8 
X-Gm-Message-State: AOUpUlFcrzitrTwY4TsQ9sTk1LZFrJTLH+FR7zk3jo75t6Y5jObDai96
	WfVkmPtvaDaOQQB10WsyOJc=
X-Google-Smtp-Source: AA+uWPyjFfNpO7uvB0dhcWO0hfoSHMrISEG6D+2+3XCSc0hVkSgnSotetyw2pneZIU3nWOqJa3V0JQ==
X-Received: by 2002:adf:9c8a:: with SMTP id d10-v6mr2911401wre.4.1534498425920;
        Fri, 17 Aug 2018 02:33:45 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a7b:c056:: with SMTP id u22-v6ls1545222wmc.2.gmail; Fri, 17
 Aug 2018 02:33:44 -0700 (PDT)
X-Received: by 2002:a1c:ed1a:: with SMTP id l26-v6mr18927349wmh.61.1534498424776;
        Fri, 17 Aug 2018 02:33:44 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1534498424; cv=none;
        d=google.com; s=arc-20160816;
        b=TXILMZ6NnZXZvtTGb0fmg3/tKosyDiOA0lLuwFzNGczzdOQoh9A5YVsHhKm3vJvwsb
         JfUlBv5zzp6o04qz1iTERmMFweF83fNeIoTmvJHLUanflPtR6ZJ46SpWFaKwny0pBPNF
         z5eEfJM0hbTtNDbU0hzzQgB/nnFN75tesZ+dUYMHYyO8E6bPs4ThHegIUNTUrKekiOGz
         fZi3E/HsUSzMVSSwa/nkr5WAK4XxV2gpXLVOnJXxk9y2s2SlA4l3SRN5/lyVOjjYEVjP
         gjAc38BQq8WqAVxE3xWF9OejiPNk4tmPW8hR1mrZJw6K5qekqBw+tJxEnb/7z1/tmWQp
         rY8Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:arc-authentication-results;
        bh=jArCdlfsBRVpnH5zqGgzBRnQ6QUZT3rAdRZL+OUcEMM=;
        b=IbVyJIJteDpoDRyUtLNJ2aMdEb6+rXGj4hz9qKfWnMpK1bLyPT4bKOzYyJTwRCijb3
         TyFse4axorxH8sUnok6bsNBf7sVAC7qquzzdFao58KdFHmzmoAeMy/7Kx1AomdFAzhyQ
         Dp4wEWIi/UKyr/RJdKlGrWlFR2VJG3owNqPWs9vXbfl1xCGC4D0neGM+gMOfRJijFem4
         YtGRjPaTFW5uExJIRrQqq7FZTDUZedQWe/bEX2EvWgZ3oB2jBMEDbIQHsTHPI3wRo/ku
         sGxb5AeHEoqVp+8phGWmPafUKPpl0hBKgg+C9fNYPSEcdk3Umtjd7l6TvpPJQCtRWS96
         Q8dw==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) smtp.mailfrom=vicente.botet@wanadoo.fr
Original-Received: from smtp.smtpout.orange.fr (smtp11.smtpout.orange.fr. [80.12.242.133])
        by mx.google.com with ESMTPS id 197-v6si2646580wmi.183.2018.08.17.02.33.44
        for <std-proposals@isocpp.org>
        (version=TLS1 cipher=AES128-SHA bits=128/128);
        Fri, 17 Aug 2018 02:33:44 -0700 (PDT)
Received-SPF: neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) client-ip=80.12.242.133;
Original-Received: from imac-de-vicente-botet-escriba.home ([86.253.39.2])
	by mwinf5d46 with ME
	id Q9Zj1y00802nUfq039ZkxF; Fri, 17 Aug 2018 11:33:44 +0200
X-ME-Helo: imac-de-vicente-botet-escriba.home
X-ME-Auth: dmljZW50ZS5ib3RldEB3YW5hZG9vLmZy
X-ME-Date: Fri, 17 Aug 2018 11:33:44 +0200
X-ME-IP: 86.253.39.2
In-Reply-To: <CAPuuy5dz_N4nwnDrmds=ROEpnUY2jQU4XGcLytxXscB=X36P1g@mail.gmail.com>
Content-Language: en-US
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 80.12.242.133 is neither permitted nor denied by best guess
 record for domain of vicente.botet@wanadoo.fr) smtp.mailfrom=vicente.botet@wanadoo.fr
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:39855
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39855>

This is a multi-part message in MIME format.
--------------48E4F9F6805358635CA35F0A
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 17/08/2018 =C3=A0 06:39, Justin Bassett a =C3=A9crit=C2=A0:
> On Thu, Aug 16, 2018 at 10:45 AM Henry Miller <hank@millerfarm.com=20
> <mailto:hank@millerfarm.com>> wrote:
>
>
>     In the past couple months I've seen several proposals for names
>     parameters.=C2=A0 Each with a list of pros and cons, and because ther=
e
>     are cons arguments against them.=C2=A0 I think we need a discussion o=
n
>     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
>     =C2=A0 =C2=A0 =C2=A0 *=C2=A0 Some people want this to be a compilatio=
n 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=20
> formatting library could use this in tandem with reflection:=20
> fmt::format("{sign} {value}", .sign =3D "$", .value =3D 1.34_usd);=20
> Language bindings to e.g. Python could use it to specify names for=20
> parameters=C2=A0=C2=A0(e.g. this could expose the parameter names to the=
=20
> language bindings: m.def([](int .a, int .b) { return a + b; }) )

I don't think this is a named parameter use case, even if it look like.=20
Note that the name of the arguments is not given by the parameter name=20
of the function, as it -is a variadic function, but for the name inside=20
the formatting string. So even if I want this to be solved, I don't=20
think it belongs to this feature.
> 6. This is a variation on 4. There may not be a bunch of defaulted=20
> arguments, but rather a few expert settings which you want the users=20
> to be able to tweak on rare occasions.
Could you elaborate?
> 7. bool arguments have meaning. It's pretty well known that something=20
> like file.open("path/to/file.txt", true) is bad, because the bool has=20
> no meaning. But file.open("path/to/file.txt", .append =3D true) isn't so=
=20
> bad because the meaning is apparent. Enums currently fill this role.
Well, not only bool arguments. int arguments have also meaning. I=20
believe this fall under case 3.

Vicente

--=20
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 e=
mail 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/698e2fea-a733-33b5-282b-b033fe8b9167%40wanadoo.f=
r.

--------------48E4F9F6805358635CA35F0A
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div class=3D"moz-cite-prefix">Le 17/08/2018 =C3=A0 06:39, Justin Basse=
tt a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite"
cite=3D"mid:CAPuuy5dz_N4nwnDrmds=3DROEpnUY2jQU4XGcLytxXscB=3DX36P1g@mail.gm=
ail.com">
      <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
      <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"
              moz-do-not-send=3D"true">hank@millerfarm.com</a>&gt; wrote:<b=
r>
          </div>
          <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
            In the past couple months I've seen several proposals for
            names parameters.=C2=A0 Each with a list of pros and cons, and
            because there are cons arguments against them.=C2=A0 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. <br>
            <br>
            I can think of 4 uses for names parameters. (If you don't
            understand these 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 comp=
ilation error,
            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 different contexts<br>
            3. it isn'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 strongly attached to it are you?<br>
          </blockquote>
          <div><br>
          </div>
          <div>Some other 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 tandem
            with reflection: <font face=3D"monospace, monospace">fmt::forma=
t("{sign}
              {value}", .sign =3D "$", .value =3D 1.34_usd)</font>; Languag=
e
            bindings to e.g. Python could use it to specify names for
            parameters=C2=A0=C2=A0(e.g. this could expose the parameter nam=
es to
            the language bindings: <font face=3D"monospace, monospace">m.de=
f([](int
              .a, int .b) { return a + b; })</font> )</div>
        </div>
      </div>
    </blockquote>
    <br>
    I don't think this is a named parameter use case, even if it look
    like. Note that the name of the arguments is not given by the
    parameter name of the function, as it -is a variadic function, but
    for the name inside the formatting string. So even if I want this to
    be solved, I don't think it belongs to this feature.<br>
    <blockquote type=3D"cite"
cite=3D"mid:CAPuuy5dz_N4nwnDrmds=3DROEpnUY2jQU4XGcLytxXscB=3DX36P1g@mail.gm=
ail.com">
      <div dir=3D"ltr">
        <div class=3D"gmail_quote">
          <div>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.</div>
        </div>
      </div>
    </blockquote>
    Could you elaborate?<br>
    <blockquote type=3D"cite"
cite=3D"mid:CAPuuy5dz_N4nwnDrmds=3DROEpnUY2jQU4XGcLytxXscB=3DX36P1g@mail.gm=
ail.com">
      <div dir=3D"ltr">
        <div class=3D"gmail_quote">
          <div>7. bool arguments have meaning. It's pretty well known
            that something like <font face=3D"monospace, monospace">file.op=
en("path/to/file.txt",
              true)</font> is bad, because the bool has no meaning. But
            <font face=3D"monospace, monospace">file.open("path/to/file.txt=
",
              .append =3D true)</font> isn't so bad because the meaning is
            apparent. Enums currently fill this role.</div>
        </div>
      </div>
    </blockquote>
    Well, not only bool arguments. int arguments have also meaning. I
    believe this fall under case 3.<br>
    <br>
    Vicente<br>
    <br>
  </body>
</html>

<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/698e2fea-a733-33b5-282b-b033fe8b9167%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/698e2fea-a733-33b5-282b-b033fe8b9167=
%40wanadoo.fr</a>.<br />

--------------48E4F9F6805358635CA35F0A--

.
