220 4625 <35af8d3d-8ed6-441c-94d0-b898711190b1@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: potswa@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Changing lambda scope
Date: Mon, 27 May 2013 05:18:42 -0700 (PDT)
Lines: 161
Approved: news@gmane.org
Message-ID: <35af8d3d-8ed6-441c-94d0-b898711190b1@isocpp.org>
References: <ae01f736-d3ac-48d6-981f-702b9ab2b3b3@isocpp.org>
 <01190eaa-6223-4d3c-a9d3-b0d850aab98e@isocpp.org>
 <CAFk2RUa61wcA=26qp-tR2QX4Y5hRE0j7AAahRKcJ38Nxph+WrQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_552_13112465.1369657122286"
X-Trace: ger.gmane.org 1369657125 23634 80.91.229.3 (27 May 2013 12:18:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 27 May 2013 12:18:45 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBI46RWGQKGQEZGTOC4Q@isocpp.org Mon May 27 14:18:46 2013
Return-path: <std-proposals+bncBCW25A7E3QCRBI46RWGQKGQEZGTOC4Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f69.google.com ([209.85.219.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBI46RWGQKGQEZGTOC4Q@isocpp.org>)
	id 1UgwNx-0007V8-3h
	for gclcip-std-proposals@m.gmane.org; Mon, 27 May 2013 14:18:45 +0200
Original-Received: by mail-oa0-f69.google.com with SMTP id i10sf36099215oag.8
        for <gclcip-std-proposals@m.gmane.org>; Mon, 27 May 2013 05:18:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:date:from:to:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=J5idllGDJ00P+yynfFqbhKLKb7p2Wc8gnFCtO3aoZ5A=;
        b=PfuPEOl0BOvZte+F4wDZhwkQaHJXFTORrXEuqX2ve8xkVcGw/ZULYngiJMJN48q6L5
         Szifl/Cc7TT0NLR9vtx6PusAHAlY9fgDdgUS21dDGtboD0pZ9uDp5m3fdzq1PQjzwyO8
         yYgAK4CeqIILntom5hVPTxZt8265yCZU431IPxDXV+bpSBZp7KfuIEdLwNRuaTzFwJA2
         De8LUyzwTNg8ivrzTPnxY9GslKz+rkz4sZvKn5se3sqE0kqjrDH3IACgcGH4b7bRBkPU
         51hpiG2y9hJtypgBhGSzYnhJJsBkzoCXDMSNfMNszdchXXEN/G1U4FfEpUoHd5xQWAO7
         CCCA==
X-Received: by 10.50.112.163 with SMTP id ir3mr8742453igb.4.1369657124087;
        Mon, 27 May 2013 05:18:44 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.62.8 with SMTP id u8ls1979009igr.16.canary; Mon, 27 May
 2013 05:18:43 -0700 (PDT)
X-Received: by 10.50.12.38 with SMTP id v6mr949385igb.4.1369657123326;
        Mon, 27 May 2013 05:18:43 -0700 (PDT)
In-Reply-To: <CAFk2RUa61wcA=26qp-tR2QX4Y5hRE0j7AAahRKcJ38Nxph+WrQ@mail.gmail.com>
X-Original-Sender: potswa@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:4625
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4625>

------=_Part_552_13112465.1369657122286
Content-Type: text/plain; charset=ISO-8859-1



> 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.

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.

  
   - 
   
   If T is a class type (including unions), its associated classes are: the 
   class itself; the class of which it is a member, if any; and its direct and 
   indirect base classes. Its associated namespaces are the namespaces of 
   which its associated classes are members. 
   
  
GCC and Clang both incorrectly accept this example:

namespace n {
struct s { struct n1 { struct n2 {}; }; };
int f( s::n1::n2 ) { return 3; }
}
int i = f( n::s::n1::n2() );

-- 

--- 
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.



------=_Part_552_13112465.1369657122286
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;"><div 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't count as an excuse 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><br>Sort of. You can return it from a la=
mbda but you can'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 matter=
s, is to pass it into a template, which is what I did with my example.<br><=
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 class and =
it becomes disconnected from its namespace.<br><br>

=09
	=09
	=09
=09
=09
		<div class=3D"page" title=3D"Page 62">
			<div class=3D"layoutArea">
				<div class=3D"column">
					<ul style=3D"list-style-type: none"><li>
							<p><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">=
If </span><span style=3D"font-size: 10.000000pt; font-family: 'LMMono10'">T=
 </span><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">is=
 a class type (including unions), its associated classes are: the class its=
elf; the class of which it is a
member, if any; and its direct and indirect base classes. Its associated na=
mespaces are the namespaces
of which its associated classes are members.
</span></p>
						</li></ul>
				</div>
			</div>
		</div>
=09
<br>GCC and Clang both incorrectly accept this example:<br><br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> n </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> s </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
n1 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> n2 </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> s</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">n1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">n2 </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
066;" class=3D"styled-by-prettify">3</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> i </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> f</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> n</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">n1</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">n2</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span></div></code></div><br></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 />

------=_Part_552_13112465.1369657122286--

.
