220 31826 <20a47769-a0c4-4f14-97a7-7b506c2dba8e@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: This variable should not be named: an identifier
 (not) to remember
Date: Tue, 28 Mar 2017 10:18:42 -0700 (PDT)
Lines: 123
Approved: news@gmane.org
Message-ID: <20a47769-a0c4-4f14-97a7-7b506c2dba8e@isocpp.org>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <CAF3xnJSBMmyno-AksyJJz5W=K4J=uY-ynYys3+v=mf5EzCp07w@mail.gmail.com>
 <CAGsORuC7LZWWtCnr9Zuoqc=zzQOeNT-KZimy6BNO+u_h3in6cA@mail.gmail.com> <14211602.1P4LjlnQMh@tjmaciei-mobl1>
 <CAGsORuBepjjTQxa0w+9Z_v+irrc6QwxqmUv98dTRarUCVHHY+A@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_14103_1962243281.1490721522457"
X-Trace: blaine.gmane.org 1490721528 21861 195.159.176.226 (28 Mar 2017 17:18:48 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 28 Mar 2017 17:18:48 +0000 (UTC)
Cc: zy@miator.net
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB45V5LDAKGQEHPIP3TY@isocpp.org Tue Mar 28 19:18:44 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBB45V5LDAKGQEHPIP3TY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f69.google.com ([209.85.214.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB45V5LDAKGQEHPIP3TY@isocpp.org>)
	id 1csulS-0004ds-6a
	for gclcip-std-proposals@m.gmane.org; Tue, 28 Mar 2017 19:18:38 +0200
Original-Received: by mail-it0-f69.google.com with SMTP id g15sf7224909itb.18
        for <gclcip-std-proposals@m.gmane.org>; Tue, 28 Mar 2017 10:18:44 -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:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=wNYEIu2CveThM+vDRZ+10MmxPiHAEL35qsRuuU4ngqQ=;
        b=MWnf7EJIJt5Nx8rNtdOH4oicnCmo/hgtzi5uA/SbKw5orpfbuecuLNAjUwzKtpNA8p
         ZIASmHnJEdisV5A/jtwldoLA0TLEr/E9FIzrSkxUa6NCvbdSSaVzGwMQRZrnfp5TpoPk
         Thz72ujmOxjpHberRZJ+fANXXcoZa++RBK8cdHMy95zC+YcvYd/+eX6ZgD3C44ty0Ypc
         WwJAuET86NWqN6EkSlPr+8r+rsFxzdszNCIpxfuU0dRDfrgBl+oic2z9/pbwp488w63Z
         Ej/wbQNuZm/WbmRRY5tOtJM23sl2v33s9gih/9TLi5lIREBA6khTXyNB3sLeLJr7hSZZ
         kN3g==
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:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=wNYEIu2CveThM+vDRZ+10MmxPiHAEL35qsRuuU4ngqQ=;
        b=jDaC/IT/gB0nWjzcKcJ9AITuyqRo0AeZ0PxUAUhen5bWqwY1CXycNVJLT4/2dXFXYt
         wwH2FPz1nxC3jDqEGL2kAWofVZR2/wYq/K3lUOYIsoReap8h4OHDFdiTuu9U23lW2AX7
         Ya8F+wwgp19ziCNXp9SUoDDZm8EzvRVFsanPmOOJigb9oWosTmdm+N3m2XhnZsZQlE46
         trJWG7vzJF1gTzJeF1SJ9xkNVXWZnaM7XvJBCFIlf2jr+3Qv4SZymNOxyE7FDXyFBZw5
         LN1qlUyd8CNa/y/OFC4QOpEgCZkPCx7HOAH1PflxUa6oI+YS0EvKkFmxjx2H2nPWsH3K
         Fc7w==
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=wNYEIu2CveThM+vDRZ+10MmxPiHAEL35qsRuuU4ngqQ=;
        b=Vs7mGTB12M3CqLvcxUnOQFtFVjN/35oH2K/fICRl8yjWAIArtjAxgF0cLB17CnN++T
         vZAiyl6PIFl9XwrFiRJqjp9kRMYbEuEjeXAjjXPQu5FJ9Vut4Y5BYp7wkLXnoiA/8ai4
         4Pg3lTrPwZqWvytCB+wKp+aUTkQlZuu6wnv1g3dwPY4E4yua0QXMxxAtwyFz0kNoKoir
         EorWQ7jA9uvhyS82olgTJjGduttmq3h2idCtD9M79tzQTeTkURNd6oA+ZGQO3pnl3V2+
         XytvGuge/QiZvesSHYm/UGy+ncHYZ13890YApR71i1/B/UVj6bOwp+jlm6TXuFOoHkGp
         RGEg==
X-Gm-Message-State: AFeK/H1GhhzjflSlSc5hieG5KLEs/E+/rTFLcM/YUHEWJL45qEZvs7XlxnUiwOcM+EzVyQ==
X-Received: by 10.107.46.135 with SMTP id u7mr9673681iou.37.1490721523893;
        Tue, 28 Mar 2017 10:18:43 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.42.168 with SMTP id e37ls10243617otb.3.gmail; Tue, 28 Mar
 2017 10:18:42 -0700 (PDT)
X-Received: by 10.157.45.133 with SMTP id g5mr377664otb.4.1490721522870;
        Tue, 28 Mar 2017 10:18:42 -0700 (PDT)
In-Reply-To: <CAGsORuBepjjTQxa0w+9Z_v+irrc6QwxqmUv98dTRarUCVHHY+A@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:31826
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31826>

------=_Part_14103_1962243281.1490721522457
Content-Type: multipart/alternative; 
	boundary="----=_Part_14104_1650800070.1490721522457"

------=_Part_14104_1650800070.1490721522457
Content-Type: text/plain; charset=UTF-8



On Tuesday, March 28, 2017 at 12:53:55 PM UTC-4, Zhihao Yuan wrote:
>
>
> On Tue, Mar 28, 2017 at 11:43 AM, Thiago Macieira <thi...@macieira.org 
> <javascript:>> wrote:
>
>> just like std::ignore, I don't expect __ here
>> > to issue a call to get(obj), nor an access to a subobject.
>> > I don't think the *preserving* semantics can fulfill the
>> > *ignoring* demand.
>>
>> It has no difference, because the structured binding is actually a 
>> *binding*,
>> so there's difference to object creation or retention. The result from
>> get_tuple is assigned to an anonymous object and all its members are 
>> retained.
>> Then it's decomposed into two elements: an anonymous one (can't be 
>> accessed)
>> and a.
>>
>
> Whether a call to get<0>(anon) being made
> certainly has difference, because it can have
> observable effect.  And, just like I showed
> in a previous discussion, the purpose of the
> anonymous object is for decomposition.  If
> nothing is decomposition it, it needs not to be
> created, therefore
>
>   auto [__, __] = get_tuple(...);
>
> should be physically equivalent to
>
>   get_tuple(...);
>
> thus, the result object is dropped on the floor.
>

No, it should not. It should create a hidden variable, initialize it with 
the return value of the expression, then extract nothing from it. The 
hidden variable will *always* be destroyed at the end of scope.

The behavior of `auto [name, __]` should not be substantially different 
from that of `auto [__, __]`. What you're saying would violate that.

-- 
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/20a47769-a0c4-4f14-97a7-7b506c2dba8e%40isocpp.org.

------=_Part_14104_1650800070.1490721522457
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, March 28, 2017 at 12:53:55 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"l=
tr"><div><br><div class=3D"gmail_quote">On Tue, Mar 28, 2017 at 11:43 AM, T=
hiago Macieira <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"yl9ZbfXDBwAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">thi...@macieira.org</a>&gt;</span> wrote:<b=
r><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex"><span>just like std::ignore, I don&#39;t e=
xpect __ here<br>
&gt; to issue a call to get(obj), nor an access to a subobject.<br>
&gt; I don&#39;t think the *preserving* semantics can fulfill the<br>
&gt; *ignoring* demand.<br>
<br>
</span>It has no difference, because the structured binding is actually a *=
binding*,<br>
so there&#39;s difference to object creation or retention. The result from<=
br>
get_tuple is assigned to an anonymous object and all its members are retain=
ed.<br>
Then it&#39;s decomposed into two elements: an anonymous one (can&#39;t be =
accessed)<br>
and a.<br>
<span></span></blockquote></div><br></div><div>Whether a call to get&lt;0&g=
t;(anon) being made<br>certainly has difference, because it can have<br>obs=
ervable effect.=C2=A0 And, just like I showed<br></div><div>in a previous d=
iscussion, the purpose of the<br>anonymous object is for decomposition.=C2=
=A0 If<br>nothing is decomposition it, it needs not to be<br>created, there=
fore<br><br></div><div>=C2=A0 auto [__, __] =3D get_tuple(...);<br><br></di=
v><div>should be physically equivalent to<br><br></div><div>=C2=A0 get_tupl=
e(...);<br><br></div><div>thus, the result object is dropped on the floor.<=
br clear=3D"all"></div></div></blockquote><div><br>No, it should not. It sh=
ould create a hidden variable, initialize it with the return value of the e=
xpression, then extract nothing from it. The hidden variable will <i>always=
</i> be destroyed at the end of scope.<br><br>The behavior of `auto [name, =
__]` should not be substantially different from that of `auto [__, __]`. Wh=
at you&#39;re saying would violate that.<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/20a47769-a0c4-4f14-97a7-7b506c2dba8e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/20a47769-a0c4-4f14-97a7-7b506c2dba8e=
%40isocpp.org</a>.<br />

------=_Part_14104_1650800070.1490721522457--

------=_Part_14103_1962243281.1490721522457--

.
