220 32503 <CADvuK0JFhG1anzEmHLg5+mhiLcHGU+31PRY=gWPhSuG0Ejd5zw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Allow Structured Binding Outside of Variable Declaration
Date: Tue, 16 May 2017 15:41:01 -0700
Lines: 114
Approved: news@gmane.org
Message-ID: <CADvuK0JFhG1anzEmHLg5+mhiLcHGU+31PRY=gWPhSuG0Ejd5zw@mail.gmail.com>
References: <e02d79e8-7d80-4614-bd25-e73fb43dad9d@isocpp.org>
 <10b21241-b683-44d5-82ce-90681b2643a4@isocpp.org> <CAFk2RUbf5skMEcsLd_hUiZrib2bGCvyrJbgsx9LV-rXaj=fBZw@mail.gmail.com>
 <CAFk2RUbgg7UMc_mFGKQZF7-PVVbEDsdoZoXL46oyxr+PLRTfvw@mail.gmail.com>
 <08ff73f1-6989-393e-ee4e-8158af2e7bed@honermann.net> <CAFk2RUaBhq7KVukgRMvqBMuBiBwZmCf+xZpD9jRtBberFoU2Rg@mail.gmail.com>
 <c70b0cd6-fa3e-d215-3fef-06eb231ed3cd@honermann.net> <CAFk2RUbiUZ4n_mXdBUTGEZSsh5C=Mf0hKbKu76PKzCCWnZfrgA@mail.gmail.com>
 <d184a83a-4f99-a8d2-6bba-1b8aeedd797c@honermann.net> <20170516164245.GA16348@fukushima.lysator.liu.se>
 <ffcb4ca3-5fb8-41b4-8b38-cfd287148cd5@honermann.net> <CAFk2RUY1AYOen-Rb8n6yzc1jsOiydbUCUDqLdKMPyiyiHnnO4w@mail.gmail.com>
 <c0bf3a06-53e5-3411-0967-b167da5d0dcd@honermann.net> <CAFk2RUYaNuKM=xhLTP_ZE97KvRUAJybUhaoFAmT+V_-7P3t1Mg@mail.gmail.com>
 <dedf6bf1-599c-400e-a392-ee7bc8be0afb@isocpp.org> <586c2633-4586-12d8-35ae-75ebab176ff8@honermann.net>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="94eb2c195864c25c1d054fabdd64"
X-Trace: blaine.gmane.org 1494974465 462 195.159.176.226 (16 May 2017 22:41:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 16 May 2017 22:41:05 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLZJYWNDQIP577NZACRUBBJCYCRE@isocpp.org Wed May 17 00:40:58 2017
Return-path: <std-proposals+bncBDLZJYWNDQIP577NZACRUBBJCYCRE@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f70.google.com ([209.85.215.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDLZJYWNDQIP577NZACRUBBJCYCRE@isocpp.org>)
	id 1dAl9G-0008M8-4P
	for gclcip-std-proposals@m.gmane.org; Wed, 17 May 2017 00:40:58 +0200
Original-Received: by mail-lf0-f70.google.com with SMTP id g133sf2602040lfg.4
        for <gclcip-std-proposals@m.gmane.org>; Tue, 16 May 2017 15:41:04 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1494974464; cv=pass;
        d=google.com; s=arc-20160816;
        b=tUubPcL6/xizia3h3KyMoUe0obSJPOeSjoMHs0rBxWKXe0yFE92ArsiIoiCzqu/WSr
         hc2UzZRft8PhMgWNZGek1xsmCrbMfHZd6JoAmm3qu1hRadas793Lo7U4deyYXLtkft53
         0eMtjusYfnbcKksHSAgeFqW+wuFnrp0czTSsSar85I0K/TGQ+AAMEyIuzr8Ai/va5K42
         XTnVsh84N9L9Xi9e8O0IPHYwjDTfLz5eFDRsr5jsmem7DfxHQ/+MHOx7baD1vz6uVtdK
         +LYq0ZaO3YsjqOTZpoLL8qbKk/0yBykKBCAVS0ly+GklxiiZ2/Ytd5mKT8By6goT7v2w
         Dn5Q==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=2D0j3HIUUMooeY/Wt9PrzhxTiGNu2nuSPK65jb4DVfo=;
        b=zPWgB+f7tWg9VTFCw+vgT5KuOoGvYSqtKN+TSwsVrFEsWha38pZ+N1B4nnZJDdjnM3
         Smw/32raf6N6MXl9U+/f3hvNAkvkrDPrE57wBMQn9kgKGZpl49/MkJWE/m6dTzbccq7A
         pOi1sw3QiK8KGNSa22pht9RKgQGw6horos68WbgTvjSAv82c/0VYNimT2k1Nc6AoumG0
         R7S2JZ0Glmljc51V0C0XpFGKCVQjtZS4avXfT1DpAQV+ePQcJICZiIbhBVTuo4KnMDe2
         +zEsXwcFXrcnQT9qxtaWBcLV2Q24EuD0sx3sOL1fitr9PyveBo9lANUx98rdDCyte7D5
         3Y1A==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com;
       spf=pass (google.com: domain of arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c09::22a as permitted sender) smtp.mailfrom=arthur.j.odwyer@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject: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=2D0j3HIUUMooeY/Wt9PrzhxTiGNu2nuSPK65jb4DVfo=;
        b=iZ6LeUc02gqDvQZMHIAIa8vcn1aHpFgFD/I88/0a17WpT0Sx1lpRje6EAiFfTk1Eiq
         rMYd/vCl5u9NoH52Q3Re7LB8YDlGjQnG1WRTABv8Tm0B0iG2cgNg1mLNUekLtLkrql2b
         iMG+wL+niZnsVp7zPQLGGGNToTtkThX9pMIDDkxZlO1qq8lQgTWbwT4bfT2ERDvNQDoj
         Y9oySo1aSuooHmyNhTlUBMPLCxlbhxY4XCmYpWwtQzU7SQqlyl9WkOy/nu20q27NEEdF
         czOYttDtZvxt9dzVDGN8B5+PmB/rhAFM8I1bCa4cbxRQA1ticTyHuo725lqVd+Ag/nY5
         /8FQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject: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=2D0j3HIUUMooeY/Wt9PrzhxTiGNu2nuSPK65jb4DVfo=;
        b=XZKOTWJcy6pXLaJqT+5in/yMzm6NkrhTLZ4cXCH8G++/ZYxJngWF79ztRbz0o+fIxP
         jDPR+X0ter+tVnV1Q2EjGB86cXk83BbmJosf6PuE22LT1CkO4unWKMa1VGxFYTB72fMT
         rIm5Rf/GTB+GHvcm1vTZUfWwwDmXTNYtpeUgDyWKp1DVM0mf/KBHmyoZIipEZkhcxdF/
         x45fjhPfX0xGHQBqNyOgaA6G1TBRtPrtb1oQov3BoG1ymPnNEyNDbAV2AdK6qBEnO2lX
         pu10sqY45s80FKDwO4DwFS0R73mGd75MAlO3P2k45hQCEQS/Jqhm9NJF0VlfJCNXWPad
         EpYw==
X-Gm-Message-State: AODbwcCcpI9TBskIkDnOdvVvestMYZTnqSA3eqOTpP3yag1ZoN19dWMc
	2wy8GJ2o7Ni4jbHw
X-Received: by 10.25.67.8 with SMTP id q8mr25925lfa.8.1494974464017;
        Tue, 16 May 2017 15:41:04 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.173.134 with SMTP id w128ls514665wme.23.gmail; Tue, 16 May
 2017 15:41:02 -0700 (PDT)
X-Received: by 10.28.103.214 with SMTP id b205mr8050948wmc.124.1494974462602;
        Tue, 16 May 2017 15:41:02 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1494974462; cv=none;
        d=google.com; s=arc-20160816;
        b=qeqs1+N7S4B8Kl0idjpt/1zPXprEyw+dPWEc9XJDyUFi5UyD7RdhOHt3sKjJfjfnb5
         0YcsCqcaxfANvJ1SMBvZzEz9ks5RAk463MWS7HvUgD5GlukiD1fyJnWb1FOAtpKhhYTV
         AWGIpY7/biWdpDtPNnI5EN4awq3d70thUwbHfz5GZxU23EIX3AOsHQx/o5iqF1QVxkkN
         /XS5sQkvnQp3jEzUOZzXhgm+WnDDxdDJ5PWH6sAb21a/N8w5jPae2C3XxG1Gvc3WSJWC
         zpA8HrvQiFqMdactC3w4Nuasm8TOekRNKZLvqLTphjKOAw9GWOuTsk5Bkeo57XG2qhlI
         EBvw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=742Mttjt+vM3mcy5Uf4/GFLbmPhwzBqo4hH4TejtYpQ=;
        b=qOtQriWzEdpE0RbFczBCupEzNx6DtgQKu18V83L5iFYrYI+Vymar5EvzC3lgAews5Y
         86wR0A+GrGS6AJ/HlQvXRvNfID5iahTqrrne94Lx0G1doZGq51Cchn9QtnH+aK1DNtLG
         CP7IzXYITuR7cZAnf9uESxbDK2Irdd4/v4u8Yzrp2O6FIzU/B/f9eXbEAJSDPz93GYmy
         JaJmm+mS2CMTjbFnLPTFbk4Etlz/wP0R2R01L7lqmKGp3ndfJ+cAIz2i1BQpCohItI3/
         L+vXqtDATIPt4OObpowCjrvhiI6gP+8PBCi/qpIDAIVMpMAoErVMPi+A+QRvx3j/FT1C
         AhOQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com;
       spf=pass (google.com: domain of arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c09::22a as permitted sender) smtp.mailfrom=arthur.j.odwyer@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com. [2a00:1450:400c:c09::22a])
        by mx.google.com with ESMTPS id v62si15298292wmb.41.2017.05.16.15.41.02
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 16 May 2017 15:41:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c09::22a as permitted sender) client-ip=2a00:1450:400c:c09::22a;
Original-Received: by mail-wm0-x22a.google.com with SMTP id b84so147463360wmh.0
        for <std-proposals@isocpp.org>; Tue, 16 May 2017 15:41:02 -0700 (PDT)
X-Received: by 10.80.152.194 with SMTP id j60mr598519edb.98.1494974462055;
 Tue, 16 May 2017 15:41:02 -0700 (PDT)
Original-Received: by 10.80.154.33 with HTTP; Tue, 16 May 2017 15:41:01 -0700 (PDT)
In-Reply-To: <586c2633-4586-12d8-35ae-75ebab176ff8@honermann.net>
X-Original-Sender: arthur.j.odwyer@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 arthur.j.odwyer@gmail.com designates 2a00:1450:400c:c09::22a as permitted
 sender) smtp.mailfrom=arthur.j.odwyer@gmail.com;       dmarc=pass (p=NONE
 sp=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: <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:32503
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32503>

--94eb2c195864c25c1d054fabdd64
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, May 16, 2017 at 2:53 PM, Tom Honermann <tom@honermann.net> wrote:

> On 05/16/2017 05:12 PM, Bengt Gustafsson wrote:
>
> Why not let a variable declaration inside a structured binding be a
> variable declaration?
>
> I eluded to this being a sound design in an earlier reply.  Is there good
> motivation for being able to declare a variable rather than a binding?  I
> find the current design highly motivating specifically because a binding =
is
> effectively an alias.
>

Speaking of "being able to declare a variable instead of a binding", this
morning I ran across this example due to Tony van Eerd:

struct Foo {
    int x =3D 0;
    std::string str =3D "world";
    ~Foo() { std::cout << str; }
};

int main() {
    auto [i, s] =3D Foo();
    std::cout << "hello ";
    s =3D "structured bindings";
    // Foo's destructor prints "hello structured bindings"!
}

....which is the nail in the coffin of "ever using C++17 structured bindings
in production code" AFAIC.

=E2=80=93Arthur

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CADvuK0JFhG1anzEmHLg5%2BmhiLcHGU%2B31PRY%3DgWPhS=
uG0Ejd5zw%40mail.gmail.com.

--94eb2c195864c25c1d054fabdd64
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tue, May 16, 2017 at 2:53 PM, Tom Honermann <span dir=
=3D"ltr">&lt;<a href=3D"mailto:tom@honermann.net" target=3D"_blank">tom@hon=
ermann.net</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=
=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-l=
eft-style:solid;padding-left:1ex">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF"><span class=3D"gmail-">
    <div class=3D"gmail-m_-6536589000383708425moz-cite-prefix">On 05/16/201=
7 05:12 PM, Bengt
      Gustafsson wrote:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">Why not let a variable declaration inside a
        structured binding be a variable declaration?</div>
    </blockquote></span>
    I eluded to this being a sound design in an earlier reply.=C2=A0 Is the=
re
    good motivation for being able to declare a variable rather than a
    binding?=C2=A0 I find the current design highly motivating specifically
    because a binding is effectively an alias.</div></blockquote><div><br><=
/div><div>Speaking of &quot;being able to declare a variable instead of a b=
inding&quot;, this morning I ran across this example due to Tony van Eerd:<=
/div><div><br></div><div><div><font face=3D"monospace, monospace">struct Fo=
o {</font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 int =
x =3D 0;</font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0=
 std::string str =3D &quot;world&quot;;</font></div><div><font face=3D"mono=
space, monospace">=C2=A0 =C2=A0 ~Foo() { std::cout &lt;&lt; str; }</font></=
div><div><font face=3D"monospace, monospace">};</font></div><div><font face=
=3D"monospace, monospace"><br></font></div><div><font face=3D"monospace, mo=
nospace">int main() {</font></div><div><font face=3D"monospace, monospace">=
=C2=A0 =C2=A0 auto [i, s] =3D Foo();</font></div><div><font face=3D"monospa=
ce, monospace">=C2=A0 =C2=A0 std::cout &lt;&lt; &quot;hello &quot;;</font><=
/div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 s =3D &quot;str=
uctured bindings&quot;;</font></div><div><font face=3D"monospace, monospace=
">=C2=A0 =C2=A0 // Foo&#39;s destructor prints &quot;hello structured bindi=
ngs&quot;!</font></div><div><font face=3D"monospace, monospace">}</font></d=
iv></div><div><br></div><div>...which is the nail in the coffin of &quot;ev=
er using C++17 structured bindings in production code&quot; AFAIC.</div><di=
v><br></div><div>=E2=80=93Arthur</div></div></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/CADvuK0JFhG1anzEmHLg5%2BmhiLcHGU%2B31=
PRY%3DgWPhSuG0Ejd5zw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0JFhG=
1anzEmHLg5%2BmhiLcHGU%2B31PRY%3DgWPhSuG0Ejd5zw%40mail.gmail.com</a>.<br />

--94eb2c195864c25c1d054fabdd64--

.
