220 29793 <1ecc764b-3dce-49ff-86b0-4d1505138fd0@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: Extending the scope of generalized lambda
 captures to include the lambda's trailing return type
Date: Thu, 15 Dec 2016 09:10:56 -0800 (PST)
Lines: 120
Approved: news@gmane.org
Message-ID: <1ecc764b-3dce-49ff-86b0-4d1505138fd0@isocpp.org>
References: <f804aae4-6aeb-4239-9deb-23c9daeed950@isocpp.org>
 <db5c50d4-3ca2-4ad9-8431-04d48326f51f@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_393_1191957542.1481821856841"
X-Trace: blaine.gmane.org 1481821867 21557 195.159.176.226 (15 Dec 2016 17:11:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 15 Dec 2016 17:11:07 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBIM5ZPBAKGQEQUW4AGA@isocpp.org Thu Dec 15 18:10:58 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBIM5ZPBAKGQEQUW4AGA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f72.google.com ([74.125.83.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBIM5ZPBAKGQEQUW4AGA@isocpp.org>)
	id 1cHZYT-0003jV-Tv
	for gclcip-std-proposals@m.gmane.org; Thu, 15 Dec 2016 18:10:54 +0100
Original-Received: by mail-pg0-f72.google.com with SMTP id f188sf119391864pgc.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 15 Dec 2016 09:10:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to: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=/Td3jHvr1EvIO0E2UrAIZwXf40uMopyyoLgzBDBA9Hk=;
        b=uI0PTujoAHt8B1I8gPcSGAN1hL5UgUVmo9g4UpSGZnJTBZ4lgVbfF6VCLrVAouNQ2w
         LWQk6zsv2QT4eVuRaAl4N7PQ+kJzNADogbuDway0pMzRRqfRIOLbPeVWBEefJ5Vbcve8
         Y7qKfWCHMsH84oeCL6QFyZKLo3kJeGtCdWvVzjd1mIcawp0rOzMvNk8MoQbAszTwp69f
         NLz6KTQYVkph156u9Tp0V7sQCxonAh1BFAtSlgrVmY0FacpeiviyjOP+dRxsDUb8wQQq
         Su5rwyLgNWHMKkyG92ERKyzSH6/GkSDhyhrcka4kYpKG5Lzo07cyuKVpetbIkPGDTbgX
         j2Xg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to: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=/Td3jHvr1EvIO0E2UrAIZwXf40uMopyyoLgzBDBA9Hk=;
        b=BFnzhvPafrxO8iZjPnm4KUh8TE8NbWuluLjqAGDK97S4X/tH1AmlcdfeFqfbqUiJip
         gihXi1dM7HpND57y054mLbVqqWLsX8yvGlB7jSlUUijQFJaEk0itlSSOdWKInMWlgNCI
         MTpPehaP/6GyCQqfVAjzEI9EHg5t+W6w5xrTs6zOdO6y/xfYA8SasOZcsauE61uTWvUD
         +2aP4PS6ARRteiPD0HxigHiqdSamaIe9yZJ2t2TQ9f9CGtKdZPJV1b4zlkdmsH9aR1yN
         MKBiMDE9S6ubK+7DeGJu58k1PxKbEiNDq2f5Op/MpTfQOPNH7O1pmZW/vk09LlypwFZO
         DZAQ==
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: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=/Td3jHvr1EvIO0E2UrAIZwXf40uMopyyoLgzBDBA9Hk=;
        b=ZI3mWtKxYTsEVMxnIxNguPyqo+jnJLehxU8mf856r8F9b8l8AxXUPa0L1gYXNmvHgE
         jyN4mBo0578601D4LBgalMRsR3PUkaOpn1VT1H4zy/AMfSW+4M9bsAEWP/9Xtw0IAGWx
         fyL8MlbGETf6HBkRzr3q8t73xt4nNs16dYuwjIeulUx8cUHPYlxIwrnjAdtwIAUNrxwf
         7ExttzU0W8AapvyFEA/RAz4sDig8ZEU1tgmOsz/iHc73hKDSb3X4DGfobA3ICRE+j/qT
         2+mxOJ8CNDaBnCMb0+SiZgjqLQVUjmNYMuCIyRDV3QkiKpzRjbjvrdVlLX/jFDC1LItN
         TfEw==
X-Gm-Message-State: AKaTC03NDpK5aVIvV+NtdcxB5n+RwK8zfYHognX+FpDkFohPJSuNvQ23Yw0ujrz1yNVWBw==
X-Received: by 10.99.114.74 with SMTP id c10mr1424155pgn.17.1481821858071;
        Thu, 15 Dec 2016 09:10:58 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.26.102 with SMTP id u35ls6759311otu.4.gmail; Thu, 15 Dec
 2016 09:10:57 -0800 (PST)
X-Received: by 10.157.56.132 with SMTP id p4mr236082otc.20.1481821857295;
        Thu, 15 Dec 2016 09:10:57 -0800 (PST)
In-Reply-To: <db5c50d4-3ca2-4ad9-8431-04d48326f51f@isocpp.org>
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:29793
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29793>

------=_Part_393_1191957542.1481821856841
Content-Type: multipart/alternative; 
	boundary="----=_Part_394_1631465146.1481821856841"

------=_Part_394_1631465146.1481821856841
Content-Type: text/plain; charset=UTF-8



On Thursday, December 15, 2016 at 12:00:35 PM UTC-5, Vittorio Romeo wrote:
>
> I would like to write a proposal, but I just realized that it would be a 
> breaking change:
> http://melpon.org/wandbox/permlink/g9eAszk1SoGPA1Lf
>
>
> struct Foo { };
>
> int main()
> {
>     Foo x;
>     auto l = [x = 10]() -> decltype(x) { return 10; };
> }  
>
> If  the proposal is accepted, this code will behave differently!
> This still feels very counter-intuitive though... I'm inclined to think 
> it's worth bringing this to the attention of the committee anyway.
>
>
Wait a minute. This *wouldn't* have been a breaking change until C++14. 
Back then, if you declared a capture, then there *must* have been a 
variable outside the lambda with that exact name and type. So in that case, 
`[x]() -> decltype(x) {...}` would be fine, since `lambda::x` and `x` have 
the same type.

It was C++14's generalized lambda capture that made it *possible* for 
`lambda::x` and `x` to have different types. So the fact that it represents 
a breaking change may not be that important.

I agree that you should try to move forward on it. If the committee wants 
to reject it due to being a breaking change, so be it. But you should note 
that it is only breaking when using generalized capture.

-- 
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/1ecc764b-3dce-49ff-86b0-4d1505138fd0%40isocpp.org.

------=_Part_394_1631465146.1481821856841
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, December 15, 2016 at 12:00:35 PM UTC-=
5, Vittorio Romeo wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><p style=3D"color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica=
,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoCo=
lorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,EmojiSymbols=
;font-size:16px">I would like to write a proposal, but I just realized that=
 it would be a breaking change:<br><a href=3D"http://melpon.org/wandbox/per=
mlink/g9eAszk1SoGPA1Lf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"t=
his.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwa=
ndbox%2Fpermlink%2Fg9eAszk1SoGPA1Lf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjC=
NEXRbzdXhldonpALH6E9xwzcko6ig&#39;;return true;" onclick=3D"this.href=3D&#3=
9;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermli=
nk%2Fg9eAszk1SoGPA1Lf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEXRbzdXhldonp=
ALH6E9xwzcko6ig&#39;;return true;">http://melpon.org/wandbox/<wbr>permlink/=
g9eAszk1SoGPA1Lf</a></p><p style=3D"color:rgb(0,0,0);font-family:Calibri,Ar=
ial,Helvetica,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji=
&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;=
,EmojiSymbols;font-size:16px"><br></p><p style=3D"color:rgb(0,0,0);font-fam=
ily:Calibri,Arial,Helvetica,sans-serif,&quot;Apple Color Emoji&quot;,&quot;=
Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Andro=
id Emoji&quot;,EmojiSymbols;font-size:16px"></p><div><span style=3D"font-fa=
mily:Consolas,monospace">struct Foo { };</span></div><div><br></div><div><s=
pan style=3D"font-family:Consolas,monospace">int main()</span></div><div><s=
pan style=3D"font-family:Consolas,monospace">{</span></div><div><span style=
=3D"font-family:Consolas,monospace">=C2=A0 =C2=A0 Foo x;</span></div><div><=
span style=3D"font-family:Consolas,monospace">=C2=A0 =C2=A0 auto l =3D [x =
=3D 10]() -&gt; decltype(x) { return 10; };</span></div><div><span style=3D=
"font-family:Consolas,monospace">} =C2=A0</span></div><div></div><br><p></p=
><p style=3D"color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-seri=
f,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&=
quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,EmojiSymbols;font-size=
:16px">If =C2=A0the proposal is accepted, this code will behave differently=
!<br>This still feels very counter-intuitive though...=C2=A0I&#39;m incline=
d to think it&#39;s worth=C2=A0bringing this to the attention of the commit=
tee anyway.</p><br></div></blockquote><div><br>Wait a minute. This <i>would=
n&#39;t</i> have been a breaking change until C++14. Back then, if you decl=
ared a capture, then there <i>must</i> have been a variable outside the lam=
bda with that exact name and type. So in that case, `[x]() -&gt; decltype(x=
) {...}` would be fine, since `lambda::x` and `x` have the same type.<br><b=
r>It was C++14&#39;s generalized lambda capture that made it <i>possible</i=
> for `lambda::x` and `x` to have different types. So the fact that it repr=
esents a breaking change may not be that important.<br><br>I agree that you=
 should try to move forward on it. If the committee wants to reject it due =
to being a breaking change, so be it. But you should note that it is only b=
reaking when using generalized capture.<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/1ecc764b-3dce-49ff-86b0-4d1505138fd0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1ecc764b-3dce-49ff-86b0-4d1505138fd0=
%40isocpp.org</a>.<br />

------=_Part_394_1631465146.1481821856841--

------=_Part_393_1191957542.1481821856841--

.
