220 7264 <CAArVCkRsuaxaHJtE80PCOF7GoiRoTd=EO-URjFcE+8OGwWk-Dw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Philipp Stephani <p.stephani2@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Named arguments proposal
Date: Sat, 12 Oct 2013 18:04:36 +0200
Lines: 91
Approved: news@gmane.org
Message-ID: <CAArVCkRsuaxaHJtE80PCOF7GoiRoTd=EO-URjFcE+8OGwWk-Dw@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>
	<CAGUrrs7P6VPw0J=-3diVWicLHOhWykH9+YVjXLUOq0Ji8==-kA@mail.gmail.com>
	<CAGsORuCDyswiF=5W1EJORYujAv+6AQxNOdBmW+tEL=tEJK3QKg@mail.gmail.com>
	<CAAKdH+HfkqrGRwM6hFXmfy4Ekn_h1i0nzqG-+3-=DkAH1-XdZQ@mail.gmail.com>
	<CAGsORuAGnBGPZCQPFW_2WO28FV4amoK9YaX4UjkAPDg_-O9ANQ@mail.gmail.com>
	<CAArVCkS6pmn2R+qgm5YAoHv1xUiPK1yyV_Y+BUW9EkFQxzcY4g@mail.gmail.com>
	<CAGsORuAg9QEa2rKcnVf+B9C8Ytsf6DQMcNfkgmwwuM3W+Uk9zQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c3675e42333704e88d648d
X-Trace: ger.gmane.org 1381593875 13937 80.91.229.3 (12 Oct 2013 16:04:35 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 12 Oct 2013 16:04:35 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD35NAXJW4GBBFPG4WJAKGQELVZXHCY@isocpp.org Sat Oct 12 18:04:40 2013
Return-path: <std-proposals+bncBD35NAXJW4GBBFPG4WJAKGQELVZXHCY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wg0-f70.google.com ([74.125.82.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD35NAXJW4GBBFPG4WJAKGQELVZXHCY@isocpp.org>)
	id 1VV1gE-0005ca-T0
	for gclcip-std-proposals@m.gmane.org; Sat, 12 Oct 2013 18:04:38 +0200
Original-Received: by mail-wg0-f70.google.com with SMTP id m15sf9574234wgh.9
        for <gclcip-std-proposals@m.gmane.org>; Sat, 12 Oct 2013 09:04:38 -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=kHn+wLamPJPc5cZQC+n6fDFENZkayxc7DKa5auALwe8=;
        b=VX70Ulc2vPFcAvFIK7ngwg7XnsPv5AF2u2+vw8QzowVxPBi8/9cnwKinvsrgF0kZT/
         4jwwTZtZbkwqBuDkrs66wG8/KdNz7IyJ6P+C8CvwpeuGRVcPcoXney1rBdISXtwgc4FD
         /HJdvVLTY/ezy5RAZ+4OcSHVS6Ze4ZevFHy83IfBOtqH8GPF793AnZSNhogfpara2l6k
         sIoIyukIgTdxUcXhSPlKDdPzunSl5HvMesXJhOs5ZYDo/EuI7OT66RK2O+ACy+cncs07
         wBhA2+jkiGJ2/u3ACNOLRS/clCmCgEGKN0O8pWB1l8WtvukqUpqojNwI8N3FlbYUhseK
         Zjiw==
X-Received: by 10.112.11.20 with SMTP id m20mr8940705lbb.4.1381593878250;
        Sat, 12 Oct 2013 09:04:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.19.34 with SMTP id b2ls431837wie.2.canary; Sat, 12 Oct
 2013 09:04:37 -0700 (PDT)
X-Received: by 10.204.247.71 with SMTP id mb7mr22534135bkb.7.1381593877359;
        Sat, 12 Oct 2013 09:04:37 -0700 (PDT)
Original-Received: from mail-lb0-x235.google.com (mail-lb0-x235.google.com [2a00:1450:4010:c04::235])
        by mx.google.com with ESMTPS id cr5si8749359bkc.234.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 12 Oct 2013 09:04:37 -0700 (PDT)
Received-SPF: pass (google.com: domain of p.stephani2@gmail.com designates 2a00:1450:4010:c04::235 as permitted sender) client-ip=2a00:1450:4010:c04::235;
Original-Received: by mail-lb0-f181.google.com with SMTP id u14so4317086lbd.26
        for <std-proposals@isocpp.org>; Sat, 12 Oct 2013 09:04:37 -0700 (PDT)
X-Received: by 10.152.116.109 with SMTP id jv13mr2389577lab.30.1381593876934;
 Sat, 12 Oct 2013 09:04:36 -0700 (PDT)
Original-Received: by 10.112.213.73 with HTTP; Sat, 12 Oct 2013 09:04:36 -0700 (PDT)
In-Reply-To: <CAGsORuAg9QEa2rKcnVf+B9C8Ytsf6DQMcNfkgmwwuM3W+Uk9zQ@mail.gmail.com>
X-Original-Sender: p.stephani2@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of p.stephani2@gmail.com designates 2a00:1450:4010:c04::235 as
 permitted sender) smtp.mail=p.stephani2@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:7264
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7264>

--001a11c3675e42333704e88d648d
Content-Type: text/plain; charset=ISO-8859-1

2013/10/8 Zhihao Yuan <zy@miator.net>

> On Tue, Oct 8, 2013 at 4:26 PM, Philipp Stephani <p.stephani2@gmail.com>
> wrote:
> > Often a dedicated options type (e.g. a namedtuple) is better
> > than a large number of keyword arguments.
>
> Lua uses this approach.  And they even has a syntax
> sugar to use func{ <table> } call instead of
> func({ <table> }).  I'm not particularly in favor of this;
> sometimes a language extension makes things cleaner.
> (And we don't have such convenient struct in C++ I guess).
>
>
Not yet, we would at least have to adopt C's named initializers:

f(a, {.b = 1, .c = 2})

Then we could think of allowing leaving out the outer braces:

f(a, .b = 1, .c = 2)

For other uses, we can adopt C# and VB's feature of auto-generating
anonymous record types:

f(a, new {.b = 1, .c = 2})  // creates a new struct type

Lots of things are still possible with only syntactic sugar and without
modifying the type system in complex ways.

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c3675e42333704e88d648d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">2013/10/8 Zhihao Yuan <span dir=3D"ltr">&lt;<a href=3D"mailto:zy@mi=
ator.net" target=3D"_blank">zy@miator.net</a>&gt;</span><br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">
<div class=3D"im">On Tue, Oct 8, 2013 at 4:26 PM, Philipp Stephani &lt;<a h=
ref=3D"mailto:p.stephani2@gmail.com">p.stephani2@gmail.com</a>&gt; wrote:<b=
r>
&gt; Often a dedicated options type (e.g. a namedtuple) is better<br>
&gt; than a large number of keyword arguments.<br>
<br>
</div>Lua uses this approach. =A0And they even has a syntax<br>
sugar to use func{ &lt;table&gt; } call instead of<br>
func({ &lt;table&gt; }). =A0I&#39;m not particularly in favor of this;<br>
sometimes a language extension makes things cleaner.<br>
(And we don&#39;t have such convenient struct in C++ I guess).<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br></div></div></blockquote><div><=
br></div><div>Not yet, we would at least have to adopt C&#39;s named initia=
lizers:</div><div><br></div><div>f(a, {.b =3D 1, .c =3D 2})</div><div><br><=
/div>
<div>Then we could think of allowing leaving out the outer braces:</div><di=
v><br></div><div>f(a, .b =3D 1, .c =3D 2)</div><div><br></div><div>For othe=
r uses, we can adopt C# and VB&#39;s feature of auto-generating anonymous r=
ecord types:</div>
<div><br></div><div>f(a, new {.b =3D 1, .c =3D 2}) =A0// creates a new stru=
ct type</div><div><br></div><div>Lots of things are still possible with onl=
y syntactic sugar and without modifying the type system in complex ways.</d=
iv>
</div></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 />

--001a11c3675e42333704e88d648d--

.
