220 7148 <CAGUrrs7P6VPw0J=-3diVWicLHOhWykH9+YVjXLUOq0Ji8==-kA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Brendon Costa <brendon.j.costa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Named arguments proposal
Date: Wed, 9 Oct 2013 06:15:21 +1100
Lines: 132
Approved: news@gmane.org
Message-ID: <CAGUrrs7P6VPw0J=-3diVWicLHOhWykH9+YVjXLUOq0Ji8==-kA@mail.gmail.com>
References: <74166da9-20f4-49b0-a9e6-47bf5be92e35@isocpp.org>
	<CAFk2RUbEaRhfAgu-hPD6vGjJoaeW6VjV1qHNK_foVXAm50ByjQ@mail.gmail.com>
	<6ba6b273-76df-4037-9851-4a2ab98f0b68@isocpp.org>
	<c602e3e5-4e64-43a1-a392-2bd3f7e2c1df@isocpp.org>
	<CAGUrrs69eOi4aX=h7YTkoNTZZPCQ995f03bnoiWEvfVRsJi1PA@mail.gmail.com>
	<CAAKdH+HSBe_mMYd1vFyNFuqGQ7PHM8XqTcOeu0BsA3R+VMLc-Q@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a1133e3300577ca04e83f9779
X-Trace: ger.gmane.org 1381259720 8978 80.91.229.3 (8 Oct 2013 19:15:20 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 8 Oct 2013 19:15:20 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC573SMG3INBBSVT2GJAKGQEVDLWU3Y@isocpp.org Tue Oct 08 21:15:24 2013
Return-path: <std-proposals+bncBC573SMG3INBBSVT2GJAKGQEVDLWU3Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wg0-f71.google.com ([74.125.82.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC573SMG3INBBSVT2GJAKGQEVDLWU3Y@isocpp.org>)
	id 1VTcke-0002Ux-D2
	for gclcip-std-proposals@m.gmane.org; Tue, 08 Oct 2013 21:15:24 +0200
Original-Received: by mail-wg0-f71.google.com with SMTP id l18sf12030056wgh.6
        for <gclcip-std-proposals@m.gmane.org>; Tue, 08 Oct 2013 12:15:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=mime-version:in-reply-to:references:date:message-id:subject:from: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:content-type;
        bh=YXYCyV+uJNAVvEGWJlTUt+BGIu1TZ28Bh9ksaE7dZRo=;
        b=he2kQfLIBuCoLD3f3uRO+YtnnMw/fxjwoxyYBtb6S5Gr7S49yllbSX+JmVBj3PFThH
         UGcstltBXga03okikf34b4I+5jwEf3Cr17d6JSkou2/DZtmHz5MHpsNrOm644IVsvnLa
         FXDyrwSZgd0j8oz4dXBBAzET8BbHrlVWG9sV3UwyUuSFahQnpFYLZzxtlKpoden8ycjr
         0L5W7K+8IsDR6IJHzL7qBoGlDDjMvYxkDD2XP52OwEM0q5QPfX0Etnjaw2gO9RCJS5YA
         Nt5LzASmYqJXi5QMiBiBRpROcZXAz5/qXFbIb/2ATrIpfrHK0uTL6LUe4coxvtsVVKtt
         Mj5Q==
X-Received: by 10.180.80.229 with SMTP id u5mr1256625wix.6.1381259723757;
        Tue, 08 Oct 2013 12:15:23 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.218.130 with SMTP id pg2ls1286606wic.41.canary; Tue, 08
 Oct 2013 12:15:21 -0700 (PDT)
X-Received: by 10.205.65.78 with SMTP id xl14mr3117696bkb.1.1381259721590;
        Tue, 08 Oct 2013 12:15:21 -0700 (PDT)
Original-Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com [2a00:1450:4010:c04::229])
        by mx.google.com with ESMTPS id i5si5464040bkr.182.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 08 Oct 2013 12:15:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of brendon.j.costa@gmail.com designates 2a00:1450:4010:c04::229 as permitted sender) client-ip=2a00:1450:4010:c04::229;
Original-Received: by mail-lb0-f169.google.com with SMTP id z5so7261302lbh.14
        for <std-proposals@isocpp.org>; Tue, 08 Oct 2013 12:15:21 -0700 (PDT)
X-Received: by 10.112.55.173 with SMTP id t13mr2747858lbp.39.1381259721142;
 Tue, 08 Oct 2013 12:15:21 -0700 (PDT)
Original-Received: by 10.114.98.100 with HTTP; Tue, 8 Oct 2013 12:15:21 -0700 (PDT)
In-Reply-To: <CAAKdH+HSBe_mMYd1vFyNFuqGQ7PHM8XqTcOeu0BsA3R+VMLc-Q@mail.gmail.com>
X-Original-Sender: brendon.j.costa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of brendon.j.costa@gmail.com designates 2a00:1450:4010:c04::229 as
 permitted sender) smtp.mail=brendon.j.costa@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE 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-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7148
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7148>

--001a1133e3300577ca04e83f9779
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 9 October 2013 00:14, Diego S=E1nchez <dsde71@gmail.com> wrote:

> Skipping over optional argument


I don't see the reason for the restrictions or the declaration markup. What
we are saying is that we can only call functions that are marked up in the
declaration with keyword arguments? I.e. Named arg calls cant be applied to
existing functions.

Why do we need to decorate the declaration at all?

Why cant we have:
void f(int x, int y=3D0, int z=3D0);

and be able to call it like:
f(x:3, z:12);
f(z:12, x:3); // Order does not matter for named params
f(1,2,3);
f(1, z:0);

f(2, x:12); // Compile error

If the reason is that existing declarations can already have multiple
different arg names, then that could easily become a compile error when
attempting to use named arg calls with those functions. All other functions
written in a sensible way could be called using the named arg syntax. You
can thus use legacy code, or code written in C etc.

This would not change anything about a function declaration or ABI or API
in a non-backwards compatible way. It only adds extra ways to be used at
the call site.

Surely this can be resolved easily:
* First resolve non-named args (holes not allowed, must come before named
args)
* Second resolve named args
* Resolve any defaults
* If any args in the function call don't have a value then it is a compile
error

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--001a1133e3300577ca04e83f9779
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On 9 October 2013 00:14, Diego S=E1nchez <span dir=3D"ltr">&lt;<a href=3D"m=
ailto:dsde71@gmail.com" target=3D"_blank">dsde71@gmail.com</a>&gt;</span> w=
rote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-styl=
e:solid;padding-left:1ex">
Skipping over optional argument</blockquote></div><br>I don&#39;t see the r=
eason for the restrictions or the declaration markup. What we are saying is=
 that we can only call functions that are marked up in the declaration with=
 keyword arguments? I.e. Named arg calls cant be applied to existing functi=
ons.</div>
<div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">Why do we n=
eed to decorate the declaration at all?</div><div class=3D"gmail_extra"><br=
></div><div class=3D"gmail_extra">Why cant we have:</div><div class=3D"gmai=
l_extra">
<span style=3D"font-family:arial,sans-serif;font-size:13px">void f(int x, i=
nt y=3D0, int z=3D0);</span><br></div><div class=3D"gmail_extra"><span styl=
e=3D"font-family:arial,sans-serif;font-size:13px"><br></span></div><div cla=
ss=3D"gmail_extra">
<span style=3D"font-family:arial,sans-serif;font-size:13px">and be able to =
call it like:</span></div><div class=3D"gmail_extra"><span style=3D"font-fa=
mily:arial,sans-serif;font-size:13px">f(x:3, z:12);</span></div><div class=
=3D"gmail_extra">
<span style=3D"font-family:arial,sans-serif;font-size:13px">f(z:12,=A0</spa=
n><span style=3D"font-family:arial,sans-serif;font-size:13px">x:3</span><sp=
an style=3D"font-family:arial,sans-serif;font-size:13px">); // Order does n=
ot matter for named params</span></div>
<div class=3D"gmail_extra"><span style=3D"font-family:arial,sans-serif;font=
-size:13px">f(1,2,3);</span><br></div><div class=3D"gmail_extra"><span styl=
e=3D"font-family:arial,sans-serif;font-size:13px">f(1, z:0);</span></div><d=
iv class=3D"gmail_extra">
<span style=3D"font-family:arial,sans-serif;font-size:13px"><br></span></di=
v><div class=3D"gmail_extra"><span style=3D"font-family:arial,sans-serif;fo=
nt-size:13px">f(2, x:12); // Compile error</span></div><div class=3D"gmail_=
extra">
<br></div><div class=3D"gmail_extra">If the reason is that existing declara=
tions can already have multiple different arg names, then that could easily=
 become a compile error when attempting to use named arg calls with those f=
unctions. All other functions written in a sensible way could be called usi=
ng the named arg syntax. You can thus use legacy code, or code written in C=
 etc.</div>
<div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">This would =
not change anything about a function declaration or ABI or API in a non-bac=
kwards compatible way. It only adds extra ways to be used at the call site.=
</div>
<div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">Surely this=
 can be resolved easily:</div><div class=3D"gmail_extra">* First resolve no=
n-named args (holes not allowed, must come before named args)</div><div cla=
ss=3D"gmail_extra">
* Second resolve named args</div><div class=3D"gmail_extra">* Resolve any d=
efaults</div><div class=3D"gmail_extra">* If any args in the function call =
don&#39;t have a value then it is a compile error</div><div class=3D"gmail_=
extra">
<br></div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra"><=
br></div><div class=3D"gmail_extra"><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a1133e3300577ca04e83f9779--

.
