220 19940 <920F56A3-A113-45D4-9CFF-98B941F013C5@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: default arguments
Date: Thu, 20 Aug 2015 15:10:54 +0800
Lines: 137
Approved: news@gmane.org
Message-ID: <920F56A3-A113-45D4-9CFF-98B941F013C5@gmail.com>
References: <ef9c7cbe-e8f1-4196-83bc-11a1c9b2798c@isocpp.org> <CANh8DEnn-PWZRNUvqhjcaJpiZk+6hyxVpy5qQXgTUw-uMhdh1A@mail.gmail.com> <ccf43684-c479-420e-a6b2-5a23673f7c5a@isocpp.org> <89bf9d09-00ed-45db-bf88-39c844707bd1@isocpp.org> <b003ffb3-2f0b-4c41-8db0-0a57743e5d93@isocpp.org> <CAD6_Qj9xzNThT7wX+LN-Rqe7CNys7s4jr==gzRoirOxCWefGwQ@mail.gmail.com> <CADvuK0KRed837_cjEpPSznMvqJCV_LZ5dFpbZ4barstddJKCmg@mail.gmail.com> <5F6E90B3-44BE-4A37-BE8F-91E1255E6407@gmail.com> <124ba022-8377-4ba3-be25-23e2134a9549@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_5C8BF3B8-BE47-48D0-B5F8-273C6BB21D04"
X-Trace: ger.gmane.org 1440054671 18888 80.91.229.3 (20 Aug 2015 07:11:11 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 20 Aug 2015 07:11:11 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCW25A7E3QCRBBP32WXAKGQEREDOJXI@isocpp.org Thu Aug 20 09:11:04 2015
Return-path: <std-proposals+bncBCW25A7E3QCRBBP32WXAKGQEREDOJXI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f200.google.com ([209.85.220.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBBP32WXAKGQEREDOJXI@isocpp.org>)
	id 1ZSK07-0007wE-Be
	for gclcip-std-proposals@m.gmane.org; Thu, 20 Aug 2015 09:11:03 +0200
Original-Received: by qkep139 with SMTP id p139sf36855340qke.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 20 Aug 2015 00:11:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:content-type:message-id:mime-version
         :subject:date:references:to:in-reply-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=0uf2iUO3XG3xlutkheMlTu+TkHrS2/Y/lUS1EbTvcY8=;
        b=jWNKix8cuxFyFo0F0Hvj8xmqKRGiW/gMQsw4vRGIwdVvA+dsJ6BoHKj7DP9eL7vtbj
         tzgYcu6hAqdsW+8FlydDkFoK0i/GDzmquYlpHKLHzEuGoFJFLXI6jDTT2kT1AFYnmbxD
         OjaMTE3sKkIarfdOkPEVZZE0BEy5Lj1GEtV+N5dg3tqQACI6stxRlgXyPjIRlmi7tZBq
         Hm+jfbmtdv7qL2uK1sD2kDzNkDbpYmlxvYFhEDHvFFqr1g9I5EVqbV9F0ymMkNH0sMwR
         7bmTxQomN03D0T9HdlaWzsux1qf0EaaPbGwG42oYJ6+/vtNzWTvg72CQT7ABRb31qDus
         0JxQ==
X-Gm-Message-State: ALoCoQkszioE2iO30OlGyJiyKX1tP7EmrePm5PmC35i7i20T1gq8qOPamCXSw9UoJQsiLMiZ4h48
X-Received: by 10.52.226.202 with SMTP id ru10mr1202861vdc.4.1440054662317;
        Thu, 20 Aug 2015 00:11:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.34.79 with SMTP id i76ls363801ioi.25.gmail; Thu, 20 Aug
 2015 00:11:01 -0700 (PDT)
X-Received: by 10.70.135.198 with SMTP id pu6mr3589766pdb.159.1440054661239;
        Thu, 20 Aug 2015 00:11:01 -0700 (PDT)
Original-Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com. [2607:f8b0:400e:c02::232])
        by mx.google.com with ESMTPS id qn16si5982513pab.174.2015.08.20.00.11.01
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 20 Aug 2015 00:11:01 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c02::232 as permitted sender) client-ip=2607:f8b0:400e:c02::232;
Original-Received: by pdbfa8 with SMTP id fa8so10965197pdb.1
        for <std-proposals@isocpp.org>; Thu, 20 Aug 2015 00:11:01 -0700 (PDT)
X-Received: by 10.70.20.196 with SMTP id p4mr3674499pde.58.1440054660905;
        Thu, 20 Aug 2015 00:11:00 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.176])
        by smtp.gmail.com with ESMTPSA id au10sm3108931pbd.81.2015.08.20.00.10.58
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Thu, 20 Aug 2015 00:11:00 -0700 (PDT)
In-Reply-To: <124ba022-8377-4ba3-be25-23e2134a9549@isocpp.org>
X-Mailer: Apple Mail (2.2098)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c02::232 as permitted
 sender) smtp.mailfrom=potswa@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-Spam-Checked-In-Group: 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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19940
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19940>

--Apple-Mail=_5C8BF3B8-BE47-48D0-B5F8-273C6BB21D04
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9308=E2=80=9320, at 11:59 AM, Nicol Bolas <jmckesson@gmail.=
com> wrote:
>=20
> What you're doing is enforcing a single struct policy, which is not somet=
hing I would want to see advocated or become commonplace. However, it does =
lack the terrible syntactic noise of the C version, so it's already ahead o=
f the curve ;)

One is better than zero=E2=80=A6 but what=E2=80=99s the impediment to group=
ing by nested sub-aggregates?

> The problem with that is that NSDMI's operate by effectively modifying co=
nstructors.

Since C++14, NSDMIs have a second method of action, by aggregate initializa=
tion. They are already allowed in aggregates.

> As for the implicit braces thing, that sounds like a very bad idea. Unifo=
rm initialization already has way too many implicit braces, to the point wh=
ere it actually gets non-uniform. It's two extra characters; I don't see it=
 as provoking that much syntactic noise.

Hmm, are you for the proposal or against? Implicit braces are the entirety =
of it. (Note that Clang and GCC already implement designated initializers, =
both only issuing a warning under -pedantic.) And they specifically don=E2=
=80=99t apply under brace (uniform) initialization.

The problem with adding designated initializers alone is that they enhance =
aggregates but not classes with constructors. This impedes refactoring an a=
ggregate into a non-aggregate, which is a very common operation.

If you look closer, there is a common syntax (already compatible with GCC <=
http://coliru.stacked-crooked.com/a/b5ecf9099e190e01> and Clang <http://col=
iru.stacked-crooked.com/a/49c98dc08aac1b18> for initializing an aggregate w=
ith designated initializers or a non-aggregate by a =E2=80=9Cvalue prototyp=
e=E2=80=9D aggregate, which is to use both parens and braces as foo({.x =3D=
 42}). It=E2=80=99s not that much typing, but it=E2=80=99s too much to be i=
diomatic, especially for a quick-and-dirty aggregate that just might become=
 more complex later.

So, my suggestion is to use parens with designated initializers as a common=
 ground between aggregates and constructors. If you=E2=80=99re writing an a=
ggregate that perhaps shouldn=E2=80=99t be an aggregate, it encourages you =
to use parens and designated initializers. This should have the added benef=
it of reducing abuse of =E2=80=9Cuniform=E2=80=9D initialization to call or=
dinary constructors. On the other hand, most such aggregates only have 2-3 =
members, and splitting out the parameter class is a bit of extra effort and=
 noise.

--=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/.

--Apple-Mail=_5C8BF3B8-BE47-48D0-B5F8-273C6BB21D04
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><div class=3D""><b=
r class=3D""><div><blockquote type=3D"cite" class=3D""><div class=3D"">On 2=
015=E2=80=9308=E2=80=9320, at 11:59 AM, Nicol Bolas &lt;<a href=3D"mailto:j=
mckesson@gmail.com" class=3D"">jmckesson@gmail.com</a>&gt; wrote:</div><div=
 class=3D""><br class=3D""><div class=3D"">What you're doing is enforcing a=
 single struct policy, which is not something I would want to see advocated=
 or become commonplace. However, it does lack the terrible syntactic noise =
of the C version, so it's already ahead of the curve ;)<br class=3D""></div=
></div></blockquote><div><br class=3D""></div><div>One is better than zero=
=E2=80=A6 but what=E2=80=99s the impediment to grouping by nested sub-aggre=
gates?</div><br class=3D""><blockquote type=3D"cite" class=3D""><div class=
=3D""><div class=3D"">The problem with that is that NSDMI's operate by effe=
ctively modifying constructors. </div></div></blockquote><div><br class=3D"=
"></div><div>Since C++14, NSDMIs have a second method of action, by aggrega=
te initialization. They are already allowed in aggregates.</div><br class=
=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><div class=3D"">=
As for the implicit braces thing, that sounds like a very bad idea. Uniform=
 initialization already has way too many implicit braces, to the point wher=
e it actually gets non-uniform. It's two extra characters; I don't see it a=
s provoking that much syntactic noise.<br class=3D""></div></div></blockquo=
te><div><br class=3D""></div></div>Hmm, are you for the proposal or against=
? Implicit braces are the entirety of it. (Note that Clang and GCC already =
implement designated initializers, both only issuing a warning under -pedan=
tic.) And they specifically don=E2=80=99t apply under brace (uniform) initi=
alization.</div><div class=3D""><br class=3D""></div><div class=3D"">The pr=
oblem with adding designated initializers alone is that they enhance aggreg=
ates but not classes with constructors. This impedes refactoring an aggrega=
te into a non-aggregate, which is a very common operation.</div><div class=
=3D""><br class=3D""></div><div class=3D"">If you look closer, there is a c=
ommon syntax (already compatible with&nbsp;<a href=3D"http://coliru.stacked=
-crooked.com/a/b5ecf9099e190e01" class=3D"">GCC</a>&nbsp;and&nbsp;<a href=
=3D"http://coliru.stacked-crooked.com/a/49c98dc08aac1b18" class=3D"">Clang<=
/a>&nbsp;for initializing an aggregate with designated initializers or a no=
n-aggregate by a =E2=80=9Cvalue prototype=E2=80=9D aggregate, which is to u=
se both parens and braces as <font face=3D"Courier" class=3D"">foo({.x =3D =
42})</font>. It=E2=80=99s not <i class=3D"">that</i>&nbsp;much typing, but =
it=E2=80=99s too much to be idiomatic, especially for a quick-and-dirty agg=
regate that just might become more complex later.</div><div class=3D""><br =
class=3D""></div><div class=3D"">So, my suggestion is to use parens with de=
signated initializers as a common ground between aggregates and constructor=
s. If you=E2=80=99re writing an aggregate that perhaps shouldn=E2=80=99t be=
 an aggregate, it encourages you to use parens and designated initializers.=
 This should have the added benefit of reducing abuse of =E2=80=9Cuniform=
=E2=80=9D initialization to call ordinary constructors. On the other hand, =
most such aggregates only have 2-3 members, and splitting out the parameter=
 class is a bit of extra effort and noise.</div><div class=3D""><br class=
=3D""></div></body></html>

<p></p>

-- <br />
<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 <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 />
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 />

--Apple-Mail=_5C8BF3B8-BE47-48D0-B5F8-273C6BB21D04--

.
