220 4616 <c110a614-dc6c-4464-905c-7fba2d51c211@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Changing lambda scope
Date: Mon, 27 May 2013 00:19:11 -0700 (PDT)
Lines: 116
Approved: news@gmane.org
Message-ID: <c110a614-dc6c-4464-905c-7fba2d51c211@isocpp.org>
References: <ae01f736-d3ac-48d6-981f-702b9ab2b3b3@isocpp.org>
 <CAFk2RUax65FEaDaeKCEdBig+bq4W4u_+39R3hsdBuyiOj-rpjA@mail.gmail.com>
 <90375ba5-8005-47da-9e84-eee151d0ba0a@isocpp.org>
 <CAFk2RUZzoT4HH8FYDJqVbj4dU+s9zUQRpYX9seprDSHDxF7U6w@mail.gmail.com>
 <CAOfiQqm2hNSOmxoSAxBSS0dL6fB=ZcbxHZDxhPD5Z_Q69hrghA@mail.gmail.com>
 <2e120ca5-740b-4301-8a32-8ac5035fa108@isocpp.org>
 <0df9d0d8-a752-4841-ba02-54780590f722@isocpp.org>
 <CAGsORuB9UByzMkk8PZC67ByrvxKFmud51jgEZxWq31TAy8Zf=g@mail.gmail.com>
 <87d2sd5k77.fsf@euclid.axiomatics.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_27_13342412.1369639151993"
X-Trace: ger.gmane.org 1369639159 2129 80.91.229.3 (27 May 2013 07:19:19 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 27 May 2013 07:19:19 +0000 (UTC)
Cc: gdr@axiomatics.org
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB44RRSGQKGQENUGOJWQ@isocpp.org Mon May 27 09:19:20 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBB44RRSGQKGQENUGOJWQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f197.google.com ([209.85.223.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB44RRSGQKGQENUGOJWQ@isocpp.org>)
	id 1Ugri9-0002xq-S8
	for gclcip-std-proposals@m.gmane.org; Mon, 27 May 2013 09:19:18 +0200
Original-Received: by mail-ie0-f197.google.com with SMTP id 16sf27844084iea.4
        for <gclcip-std-proposals@m.gmane.org>; Mon, 27 May 2013 00:19:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:date:from:to:cc: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=O5Onygd3g57pDgO5jKhV2s0XQEiI4zlVeNfUZllok7E=;
        b=DumxZHG/Tdbxl+K9jFhixlIWssmE/+/PQrT2AopNlXbyEq7e9kxjSmihx2eZSB1X6s
         2Ozeg12+571OiNZg+jgT2qfanTP6h1GWn1jB7hiWa5rtcVf5+cdGALr5ZcnfFCpbM2+r
         Kv8z6WkUL3YH8Jsp30atefgWAqiQc1CMRS9jfHOkZ/Sw+N+sqr6xTISaFynGV08UAVZ1
         QVFiWiJMnzE5NzJsFkDoaymvReyJ78ikXCQyUKiydhWorUI+lH2Hc4uSzxDa4FOi6lEw
         AVBD3KqnFlp5JDMM975RdoGa+uck+OAJtqVICfk7a9mP99qit7bufwWzBQiFcxbMlzn8
         dm8g==
X-Received: by 10.50.112.201 with SMTP id is9mr7899741igb.3.1369639156965;
        Mon, 27 May 2013 00:19:16 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.12.7 with SMTP id u7ls1776225igb.25.gmail; Mon, 27 May 2013
 00:19:13 -0700 (PDT)
X-Received: by 10.50.56.6 with SMTP id w6mr854132igp.0.1369639153349;
        Mon, 27 May 2013 00:19:13 -0700 (PDT)
In-Reply-To: <87d2sd5k77.fsf@euclid.axiomatics.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: <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:4616
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4616>

------=_Part_27_13342412.1369639151993
Content-Type: text/plain; charset=ISO-8859-1



On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:
>
> Zhihao Yuan <lic...@gmail.com <javascript:>> writes: 
>
> | On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <jmck...@gmail.com<javascript:>> 
> wrote: 
> | > A lambda is nothing special; it's just shorthand notation for a type 
> | > declared at that scope. We shouldn't have special-case language in the 
> | > standard that says "if the local type is a lambda type, blah blah". 
> | 
> | I don't agree.  Lambda is special, conceptually, as a language 
> structure. 
> | It's described in terms of a class / class template does not mean its 
> | semantics has to be limited by class / class template. 
>
> I tend to agree that a lambda expression is a fundamental language 
> construct (from semantics point of view), and it is unfortunate that we 
> somehow think of it in terms of local classes.  We shouldn't think of 
> lambdas in terms of implementation details.


Whatever they may be "from semantics point of view", they are still just 
types. The fact that there's nothing a lambda can do which you can't do 
yourself is a *strength* of C++ lambdas, not a weakness. It allows you to 
swap a lambda for a regular class if the lambda gets too complex for the 
lambda syntax to work. The class version will have the *exact* same 
behavior as the lambda version, modulo extra features of the class.

We should not allow lambdas to do anything you couldn't do yourself. We 
don't want people overloading on lambdas. We don't want people writing 
huge, complex lambdas when a struct definition would be more appropriate, 
and having different functionality between lambdas and structs would *
encourage* doing this. However much people may want lambdas to be some 
unique construct with its own special rules, C++ shouldn't allow that.

It's just a class with a operator() overload. We should not pretend that 
it's anything but 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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_27_13342412.1369639151993
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;borde=
r-left: 1px #ccc solid;padding-left: 1ex;">Zhihao Yuan &lt;<a href=3D"javas=
cript:" target=3D"_blank" gdf-obfuscated-mailto=3D"DQMA8Us_THUJ">lic...@gma=
il.com</a>&gt; writes:
<br>
<br>| On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas &lt;<a href=3D"javascrip=
t:" target=3D"_blank" gdf-obfuscated-mailto=3D"DQMA8Us_THUJ">jmck...@gmail.=
com</a>&gt; wrote:
<br>| &gt; A lambda is nothing special; it's just shorthand notation for a =
type
<br>| &gt; declared at that scope. We shouldn't have special-case language =
in the
<br>| &gt; standard that says "if the local type is a lambda type, blah bla=
h".
<br>|=20
<br>| I don't agree. &nbsp;Lambda is special, conceptually, as a language s=
tructure.
<br>| It's described in terms of a class / class template does not mean its
<br>| semantics has to be limited by class / class template.
<br>
<br>I tend to agree that a lambda expression is a fundamental language
<br>construct (from semantics point of view), and it is unfortunate that we
<br>somehow think of it in terms of local classes. &nbsp;We shouldn't think=
 of
<br>lambdas in terms of implementation details.</blockquote><div><br>Whatev=
er they may be "from semantics point of view", they are still just types. T=
he fact that there's nothing a lambda can do which you can't do yourself is=
 a <i>strength</i> of C++ lambdas, not a weakness. It allows you to swap a =
lambda for a regular class if the lambda gets too complex for the lambda sy=
ntax to work. The class version will have the <i>exact</i> same behavior as=
 the lambda version, modulo extra features of the class.<br><br>We should n=
ot allow lambdas to do anything you couldn't do yourself. We don't want peo=
ple overloading on lambdas. We don't want people writing huge, complex lamb=
das when a struct definition would be more appropriate, and having differen=
t functionality between lambdas and structs would <i>encourage</i> doing th=
is. However much people may want lambdas to be some unique construct with i=
ts own special rules, C++ shouldn't allow that.<br><br>It's just a class wi=
th a operator() overload. We should not pretend that it's anything but that=
..<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_27_13342412.1369639151993--

.
