220 4626 <CAFk2RUbcP65Wcxf55za-CfcRbPiR917Lg5qVGfYC0S0T7A9nQA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Changing lambda scope
Date: Mon, 27 May 2013 15:31:24 +0300
Lines: 105
Approved: news@gmane.org
Message-ID: <CAFk2RUbcP65Wcxf55za-CfcRbPiR917Lg5qVGfYC0S0T7A9nQA@mail.gmail.com>
References: <ae01f736-d3ac-48d6-981f-702b9ab2b3b3@isocpp.org>
	<01190eaa-6223-4d3c-a9d3-b0d850aab98e@isocpp.org>
	<CAFk2RUa61wcA=26qp-tR2QX4Y5hRE0j7AAahRKcJ38Nxph+WrQ@mail.gmail.com>
	<35af8d3d-8ed6-441c-94d0-b898711190b1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e0102f736a62d9c04ddb25385
X-Trace: ger.gmane.org 1369657888 31710 80.91.229.3 (27 May 2013 12:31:28 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 27 May 2013 12:31:28 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5JHI7A7ALRBHFERWGQKGQEEPYNRJI@isocpp.org Mon May 27 14:31:28 2013
Return-path: <std-proposals+bncBC5JHI7A7ALRBHFERWGQKGQEEPYNRJI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qa0-f70.google.com ([209.85.216.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBHFERWGQKGQEEPYNRJI@isocpp.org>)
	id 1UgwaE-00021S-3w
	for gclcip-std-proposals@m.gmane.org; Mon, 27 May 2013 14:31:26 +0200
Original-Received: by mail-qa0-f70.google.com with SMTP id o13sf2808115qaj.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 27 May 2013 05:31:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:mime-version:in-reply-to:references:date:message-id
         :subject:from:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=Fw0IWDoxeXMwir7CTy+HXGnRM0SwcWTtwZaY3ikSGiM=;
        b=0ofeF10TJubkBpLYj5R3OKUgzMotugMx5JOvewspzSt7cuxMb+Dh5OvXPSV3mQR6Dz
         Bln/lEYHTUZZ0Yn7lucFTFoAzWJFcP+Elzk0xbMnoitUGeyIna8K646l7el+OycxCVDJ
         eZG9QJ07BsFM1auyY6FNNtSC8cl6gCVTBA/Q+Qgw8Ld08fTDokpU6oMCQLNinW23Llug
         aXrhSX6z4i8x8M5L6L2QPJ3L2MZ207u3265W9wDMGIfKQuYk/O0JPhdTYDe9Vhyy5M1A
         gy2/8nG0sWEb6JSCtACaJFo1FKIpcC03bQbAa7MeEMKEhPRSFNl7owhqLqZ2/1qhtS7F
         FljA==
X-Received: by 10.236.93.116 with SMTP id k80mr14294850yhf.32.1369657885299;
        Mon, 27 May 2013 05:31:25 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.41.7 with SMTP id b7ls2746090qel.12.gmail; Mon, 27 May 2013
 05:31:24 -0700 (PDT)
X-Received: by 10.229.170.18 with SMTP id b18mr33000qcz.5.1369657884265;
        Mon, 27 May 2013 05:31:24 -0700 (PDT)
Original-Received: from mail-qa0-x232.google.com (mail-qa0-x232.google.com [2607:f8b0:400d:c00::232])
        by mx.google.com with ESMTPS id gt9si24229913qab.16.2013.05.27.05.31.24
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 27 May 2013 05:31:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400d:c00::232 as permitted sender) client-ip=2607:f8b0:400d:c00::232;
Original-Received: by mail-qa0-f50.google.com with SMTP id bn16so949825qab.2
        for <std-proposals@isocpp.org>; Mon, 27 May 2013 05:31:24 -0700 (PDT)
X-Received: by 10.224.146.66 with SMTP id g2mr6999994qav.50.1369657884150;
 Mon, 27 May 2013 05:31:24 -0700 (PDT)
Original-Received: by 10.224.174.143 with HTTP; Mon, 27 May 2013 05:31:24 -0700 (PDT)
In-Reply-To: <35af8d3d-8ed6-441c-94d0-b898711190b1@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of ville.voutilainen@gmail.com designates 2607:f8b0:400d:c00::232 as
 permitted sender) smtp.mail=ville.voutilainen@gmail.com;       dkim=pass header.i=@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:4626
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4626>

--089e0102f736a62d9c04ddb25385
Content-Type: text/plain; charset=ISO-8859-1

On 27 May 2013 15:18, <potswa@gmail.com> wrote:

>
> You can return a lambda or a local class from a lambda in C++11, so that
>> doesn't count as an excuse for noticing this now because
>> we can return local types from a non-lambda in C++14.
>>
>
> Sort of. You can return it from a lambda but you can't return it out of
> the enclosing non-lambda function scope. The only way to pass it out of the
> *namespace*, which is what matters, is to pass it into a template, which
> is what I did with my example.
>

I'm not sure I quite follow.

namespace N {
    auto x = [](){
       return  [](){std::cout << "In the inner lambda" << std::endl;};
    };
}

int main()
{
    auto y = N::x;
    auto z = y();
    z();
}

The inner lambda got passed out of the namespace just fine, and that works
in C++11.


>
> By the way, the language as-is seems deeply flawed. Only a singly-nested
> class has an associated namespace; nest a class inside a nested class and
> it becomes disconnected from its namespace.
>

Interesting.

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--089e0102f736a62d9c04ddb25385
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 27 May 2013 15:18,  <span dir=3D"ltr">&lt;<a href=3D"mailto:pots=
wa@gmail.com" target=3D"_blank">potswa@gmail.com</a>&gt;</span> wrote:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex">
<div class=3D"im"><br><blockquote class=3D"gmail_quote" style=3D"margin:0px=
 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><di=
v dir=3D"ltr"><div><div class=3D"gmail_quote"><div>You can return a lambda =
or a local class from a lambda in C++11, so that doesn&#39;t count as an ex=
cuse for noticing this now because<br>
we can return local types from a non-lambda in C++14.<br></div></div></div>=
</div></blockquote></div><div><br>Sort of. You can return it from a lambda =
but you can&#39;t return it out of the enclosing non-lambda function scope.=
 The only way to pass it out of the <i>namespace</i>, which is what matters=
, is to pass it into a template, which is what I did with my example.<br>
</div></blockquote><div><br></div><div>I&#39;m not sure I quite follow.<br>=
<br>namespace N {<br>=A0=A0=A0 auto x =3D [](){<br>=A0 =A0 =A0=A0 return=A0=
 [](){std::cout &lt;&lt; &quot;In the inner lambda&quot; &lt;&lt; std::endl=
;};<br>=A0=A0=A0 };<br>
} <br><br>int main() <br>{<br>=A0=A0=A0 auto y =3D N::x; <br>=A0=A0=A0 auto=
 z =3D y(); <br>=A0=A0=A0 z();<br>}<br><br></div><div>The inner lambda got =
passed out of the namespace just fine, and that works in C++11.<br>=A0<br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><br>By the way, the language as-is seems deeply flawed. Only a singly-=
nested class has an associated namespace; nest a class inside a nested clas=
s and it becomes disconnected from its namespace.<br></div></blockquote>
<div><br></div><div>Interesting.<br></div></div></div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--089e0102f736a62d9c04ddb25385--

.
