220 33349 <ad912456-47bb-4775-bb49-8750682efd5d@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: P0329R0 falls short for designated initialisers
Date: Wed, 26 Jul 2017 10:49:20 -0700 (PDT)
Lines: 128
Approved: news@gmane.org
Message-ID: <ad912456-47bb-4775-bb49-8750682efd5d@isocpp.org>
References: <4892340.tBhI7hZKOg@tjmaciei-mobl1> <HK2PR03MB0675734258FE57E7D3EF4F048BB90@HK2PR03MB0675.apcprd03.prod.outlook.com>
 <CAGsORuCwv68-tgDzEVVAbPUmuGp8B+pMcTiSFfc+iQv4MtMj=w@mail.gmail.com> <HK2PR03MB0675A1D3DAEFE1F919D265ED8BB90@HK2PR03MB0675.apcprd03.prod.outlook.com>
 <CAGsORuAWU1Ke__C+Zk004EiHPjm9bL2PA=XrZFCav1fx=aaaKA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3512_1575275533.1501091360807"
X-Trace: blaine.gmane.org 1501091369 2342 195.159.176.226 (26 Jul 2017 17:49:29 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 26 Jul 2017 17:49:29 +0000 (UTC)
Cc: d25fe0be@outlook.com, thiago@macieira.org, zy@miator.net
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBINM4PFQKGQEJK5RHTA@isocpp.org Wed Jul 26 19:49:24 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBINM4PFQKGQEJK5RHTA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f197.google.com ([209.85.192.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBINM4PFQKGQEJK5RHTA@isocpp.org>)
	id 1daQQv-0008Rp-Ao
	for gclcip-std-proposals@m.gmane.org; Wed, 26 Jul 2017 19:49:17 +0200
Original-Received: by mail-pf0-f197.google.com with SMTP id 72sf112757737pfl.12
        for <gclcip-std-proposals@m.gmane.org>; Wed, 26 Jul 2017 10:49:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=iLQbJGgMl0wrkE3xoYtBbbfJWsxpUysTs2KV0ClQQJ0=;
        b=k0ZOdIg0ovBozBjrIWnV43woCCvts80m1SFe9Lio1iHH4g10BG5CEVRulnCCP/Sk2i
         zPA9/5UMcWGhvWcaWGU8hKF1gSMttvuFM59trc4HctAWwGbQxB5wO5iq8gV5Wrxr3fsq
         kiP3wwZB0ZwrYst+YJAp7IPOs0gCora4Pci4Qq6kgq7LMvqwTO88hUiv5qBfbT2R9oDJ
         n/Vz2TEFo3sj+aHyeso+48ADO3yCOpgJ0O4/WqxMW0dGlR5q0B6k74oVbBZeYK62yFxB
         1yEdVXFcUvdX4jdZpJsA1XCtBmUdKtXEsMIF9k9NVAzbuyoCb+RdoiJIoM8gODN7cU31
         2oSg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=iLQbJGgMl0wrkE3xoYtBbbfJWsxpUysTs2KV0ClQQJ0=;
        b=kFHebyS5s2B8z1+QfnKfyGPtD4FDiDaDcVY6HDEV6Z3m67joqeMgTdoBU156d3fJXX
         GoaijttvSYZJ4DsFuFJf8mQ/VpjqU5D5CeXGTvT8M3tEuQ/tYutybpotFJ4LBZWJhnwq
         fRFzRRKJ7MqZ6WJcEIracT4t0zSEOg+g6ww8KKCR7C88jcl8wYsdPIXvI26PpivXGEV0
         oeiATmvU8B2kXR2iuRfWt+a9vpzrbMJpBGRkSFieSL+gV21Wo6K8i6S8xQnOI9aLJGYg
         LtlQPtyb0CITqVJ7hR1ND00KqgEBHktw3IJHdQiYy5McVJt5hZxO/BdDx+5VqYZ+6+fV
         3bYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=iLQbJGgMl0wrkE3xoYtBbbfJWsxpUysTs2KV0ClQQJ0=;
        b=gzH2muw2N/yeJJcI6dPIyXJBXpqf0tzcRNF+Bvsqazg9NuFKU1hxUdnF/DQqDEIuwi
         NaGZ7VR+9CTtGy0ySGlYTeqgDT+GGcJc6bEBteZLudg6ASt4W3qSO+rtWUyDWgsrzunv
         nhmv1sgkWp3xVQEDLJ0nUhKEp7BZ/fhBOlS4HkvILHLc+dgqa4b+PFjR0PjbI/4nFRPa
         DLE2I/eVJHh+jl6/74q7G/JliAhINmSH6Nxr/XHfpUuA3DKCtOG9ki03TzkaY4KvP5Qi
         b2P8nDExdngSPupA3R0ZDqqFFtsHvJkByTJuTJLcGPZHBciFABaj++ybVHlP+TXtPdTN
         aNLw==
X-Gm-Message-State: AIVw113/DTIrY/E78tRZNuKN3H7Y1x05MoOePvSdU3M7/jG2kNSR89Wt
	XVVVDaT2uM2boh72
X-Received: by 10.98.66.90 with SMTP id p87mr1073153pfa.21.1501091362790;
        Wed, 26 Jul 2017 10:49:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.168.193 with SMTP id e62ls1000279ioj.6.gmail; Wed, 26 Jul
 2017 10:49:21 -0700 (PDT)
X-Received: by 10.36.80.193 with SMTP id m184mr58177itb.6.1501091361485;
        Wed, 26 Jul 2017 10:49:21 -0700 (PDT)
In-Reply-To: <CAGsORuAWU1Ke__C+Zk004EiHPjm9bL2PA=XrZFCav1fx=aaaKA@mail.gmail.com>
X-Original-Sender: jmckesson@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: <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:33349
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33349>

------=_Part_3512_1575275533.1501091360807
Content-Type: multipart/alternative; 
	boundary="----=_Part_3513_1907833215.1501091360807"

------=_Part_3513_1907833215.1501091360807
Content-Type: text/plain; charset="UTF-8"



On Wednesday, July 26, 2017 at 1:10:26 PM UTC-4, Zhihao Yuan wrote:
>
> On Jul 26, 2017 5:18 AM, "d25f...@outlook.com <javascript:>" <
> d25f...@outlook.com <javascript:>> wrote:
>
>
> By "initialization order", I was trying to mean "the order the
> designated initializers are listed", not "the order the class' member
> variables are initialized". Sorry for the misleading term.
>
> What I tried to mean is that we can "repeat the mistake" and initialize
> the object using the order its members are declared, regardless the
> order the designated initializers are listed, and leaves the compiler to
> warn the user if appropriate. We can also allow the user to suppress the
> warning using some attribute on his will.
>
> Still, even if it's a mistake for mem-init-clause, for the third party
> structures whose definition cannot be controlled by us, the "severity of
> the mistake" is mitigated.
>
>
> The severity of the mistake is increased.
> You essentially get a feature to
> encourage silently breaking users'
> legitimate code which relies on a
> specific evaluation order of the
> initializers by changing the member
> declaration order at the library side.
>
>
I think another way to look at it is this. Designated initializers are just 
a convenience form of aggregate initialization (one that notably allows you 
to skip members and let them be initialized via their default member 
initializers). If you couldn't guarantee the order of the items in the 
struct, then you couldn't use aggregate initialization to begin with.  And 
thus, you shouldn't be surprised that you can't use designated initializers.

Initializing members out-of-order through aggregate initialization would be 
a new thing, not a convenience feature.

-- 
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/ad912456-47bb-4775-bb49-8750682efd5d%40isocpp.org.

------=_Part_3513_1907833215.1501091360807
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, July 26, 2017 at 1:10:26 PM UTC-4, Z=
hihao Yuan wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"a=
uto"><div><div><div class=3D"gmail_quote">On Jul 26, 2017 5:18 AM, &quot;<a=
 href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"N2DLlQxzAA=
AJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;retur=
n true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">d25f...=
@outlook.com</a>&quot; &lt;<a href=3D"javascript:" target=3D"_blank" gdf-ob=
fuscated-mailto=3D"N2DLlQxzAAAJ" rel=3D"nofollow" onmousedown=3D"this.href=
=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascri=
pt:&#39;;return true;">d25f...@outlook.com</a>&gt; wrote:<blockquote style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br=
></div>
By &quot;initialization order&quot;, I was trying to mean &quot;the order t=
he<br>
designated initializers are listed&quot;, not &quot;the order the class&#39=
; member<br>
variables are initialized&quot;. Sorry for the misleading term.<br>
<br>
What I tried to mean is that we can &quot;repeat the mistake&quot; and init=
ialize<br>
the object using the order its members are declared, regardless the<br>
order the designated initializers are listed, and leaves the compiler to<br=
>
warn the user if appropriate. We can also allow the user to suppress the<br=
>
warning using some attribute on his will.<br>
<br>
Still, even if it&#39;s a mistake for mem-init-clause, for the third party<=
br>
structures whose definition cannot be controlled by us, the &quot;severity =
of<br>
the mistake&quot; is mitigated.</blockquote></div></div></div><div dir=3D"a=
uto"><br></div><div dir=3D"auto">The severity of the mistake is increased.<=
/div><div dir=3D"auto">You essentially get a feature to</div><div dir=3D"au=
to">encourage silently breaking users&#39;</div><div dir=3D"auto">legitimat=
e code which relies on a</div><div dir=3D"auto">specific evaluation order o=
f the</div><div dir=3D"auto">initializers by changing the member</div><div =
dir=3D"auto">declaration order at the library side.</div><br></div></blockq=
uote><div><br>I think another way to look at it is this. Designated initial=
izers are just a convenience form of aggregate=20
initialization (one that notably allows you to skip members and let them
 be initialized via their default member initializers). If you couldn&#39;t=
 guarantee the order of the items in the struct, then you couldn&#39;t use =
aggregate initialization to begin with.=C2=A0 And thus, you shouldn&#39;t b=
e surprised that you can&#39;t use designated initializers.<br><br>Initiali=
zing members out-of-order through aggregate initialization would be a new t=
hing, not a convenience feature.<br></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/ad912456-47bb-4775-bb49-8750682efd5d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ad912456-47bb-4775-bb49-8750682efd5d=
%40isocpp.org</a>.<br />

------=_Part_3513_1907833215.1501091360807--

------=_Part_3512_1575275533.1501091360807--

.
