220 29685 <db9eb530-1da1-47d2-98f5-a4c08ec43cd4@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: compiler should infer last semicolon of culy
 brace block... it makes lambas look better....
Date: Tue, 6 Dec 2016 13:30:54 -0800 (PST)
Lines: 167
Approved: news@gmane.org
Message-ID: <db9eb530-1da1-47d2-98f5-a4c08ec43cd4@isocpp.org>
References: <99df401b-562e-424f-9c17-01575f8b47e1@isocpp.org>
 <7ac0450f-1fe9-4787-bfba-5bde4c08abb8@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_92_1533801044.1481059855091"
X-Trace: blaine.gmane.org 1481059859 27543 195.159.176.226 (6 Dec 2016 21:30:59 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 6 Dec 2016 21:30:59 +0000 (UTC)
Cc: wm2015email@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBD64TTBAKGQEZJHN3EA@isocpp.org Tue Dec 06 22:30:54 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBD64TTBAKGQEZJHN3EA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f197.google.com ([209.85.223.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBD64TTBAKGQEZJHN3EA@isocpp.org>)
	id 1cENK9-0006O9-5n
	for gclcip-std-proposals@m.gmane.org; Tue, 06 Dec 2016 22:30:53 +0100
Original-Received: by mail-io0-f197.google.com with SMTP id m203sf263067357iom.6
        for <gclcip-std-proposals@m.gmane.org>; Tue, 06 Dec 2016 13:30:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc: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=lDEqArvyCFHiT1e2vIgMXafYpuDmbAnIy6rUS4UMLdk=;
        b=Rekydz3AIm5k5AMAFCeQOynL8Loc2YB2hoMNs9zlPamcj7ioYYL8W5Lp65CXaMiwa3
         eG6Vi2hiNbGuuCnwioJbc9014niIJrxE2rl/fuBplZxH6Xj6lwpY+9bFpG7cTw0lXP8j
         fLasONg4BN0Y/uxVlYIjseH/85CIeZrINVLXebxJ7q3+6nVmya3/49lU324eCibRhGgl
         jgvvcDq+FiAhR8VHYyxsD6S7ElIVZsxfgMZyRZPW+sxPHK0jtE9oPZ1DsEYb2EuE9raB
         vBHjeq0R+R/jXBR6PHMIg5PL7fB70EWHBCNjU5SxM1E65Tbjs8gQv5GKLPcZF04DJOFl
         S/Zw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc: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=lDEqArvyCFHiT1e2vIgMXafYpuDmbAnIy6rUS4UMLdk=;
        b=rx/K/RAbAvc7hKGT/nNiVTwahjlV8u7aFfD3wJSHhl4Ng7r9IRwr5pW7RJaNpAr87Q
         a6mW6K5mduNntrhbwHTidj8/ZA3Z2qKNC1mveG9K2xNH5OlBpu5qBF0sfnDm9WDze6BX
         v3BAVsgBC4eMWoYwNL4kilVYZtI+TSH4LZg3ZEjFSffwjJsD8BxpOJaMk8vjsIJHztP/
         1YP/q5BFCRzN1ly/6yu0E2ZQ8ALd3Au2kAmiP2pQ6/lGVFAN3YGjuEgVd7MKPpZwh2iO
         NPvqYW1PMqX0zrJsTWWQDsOXlyehTbgH8enaGteYjpFQgzEFb9nNkaY8huO6KXZV4Jk2
         SNZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc: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=lDEqArvyCFHiT1e2vIgMXafYpuDmbAnIy6rUS4UMLdk=;
        b=IkkusES0J2H8KVxLfmmV2UMU60W9xeVBYinOfzwDnXyn65COW9vvtoU+rQKbR5c2ea
         QakGk8AVEFlSHkibnmj0L56DFefa0O3Rhxiypl+urxR/nW2uBQOIB2whW1exd9DWlOHY
         KmYeweLCtYG1VynAzh5CEtDWU/bDQM3vjtwL86Yw/1NFeIleiv0VbIYtLGj6gL1gsQIL
         ZAH6/suZwu4Fxhci8rIWmKF3t8uZmAVLnde/ZeRFbtM+3uUe86c69NYTtcHFI6N5jbWd
         FcHLEQ59gh/xR+l5AKLwx7XtNfpphIfzohgXo7E3F1IyBL48VXZ8sDyRXtSAeuT43n3Z
         7fNg==
X-Gm-Message-State: AKaTC00oOucgV/j5bYArHZTBUFv3be1czbZgwFV5fF26/+jqbN7GbFJ5lekYbKt7BNa37w==
X-Received: by 10.107.178.65 with SMTP id b62mr14718829iof.64.1481059856595;
        Tue, 06 Dec 2016 13:30:56 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.58.38 with SMTP id j35ls2423529otc.17.gmail; Tue, 06 Dec
 2016 13:30:55 -0800 (PST)
X-Received: by 10.157.8.134 with SMTP id 6mr4198782otf.17.1481059855697;
        Tue, 06 Dec 2016 13:30:55 -0800 (PST)
In-Reply-To: <7ac0450f-1fe9-4787-bfba-5bde4c08abb8@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:29685
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29685>

------=_Part_92_1533801044.1481059855091
Content-Type: multipart/alternative; 
	boundary="----=_Part_93_150103289.1481059855091"

------=_Part_93_150103289.1481059855091
Content-Type: text/plain; charset=UTF-8

On Monday, December 5, 2016 at 5:33:29 PM UTC-5, Erich Keane wrote:
>
> On Friday, December 2, 2016 at 6:49:08 AM UTC-8, wm201...@gmail.com wrote:
>>
>> Good code vs.Bad Code
>>
>> #define LAMBA [=]
>>
>> menu1.callback("Log->Clear", LAMBDA() {dosomething1(); dosomthing2()});
>>
>> ^^^ Abouve with Inferred last semi-colon: LOOKS GOOD, but a compiler 
>> error.  
>> Why not make it legal to infer the last semicolon in a curly brace block? 
>>
>>
>> Compiles... but the syntax gets on your nerves:
>>
>>         menu1.callback("Log->Clear", [=]() {dosomething1(); 
>> dosomthing2();}); //extra semicolon at the end
>>
>>
>> sure Laugh now.  But all those semicolons add up in a large program...
>>
>>
>> Actually while we are on this one.  I always like the "perl feature of 
>> allowing extra "commas" when defining a list.  this feature sames a huge 
>> amount of lot of time when writing programs that write programs without all 
>> the extra garbage code needed to detect the end of list to remove comma at 
>> the end of the list:
>>
>> GOOD:  (thank you perl)
>>   vector<string> blah {
>>     "one",
>>     "two",
>>     "three",  // <= extra comma ok... ignored without warn
>>   };
>>
>> BAD: (no thanks c++: lighten up a little bit c++ compiler... )
>>   vector<string> blah {
>>     "one",
>>     "two",
>> .    "three"  // <=== no comma allowed here... now all of my loops need 
>> extra if block to detect end of list when writing programs that write 
>> programs...
>>   };
>>
>> now you are asking... why on earth would anybody ever want to write a 
>> program that writes a program?
>> it happens more often than you think...
>>
>>
>>
>> This seems like a pretty minor thing, I'm not a huge fan of changing the 
> grammar that much in the name of saving single characters.  Others have 
> mentioned the many problems with automatic return type.
>
> That said, 1 feature that I REALLY miss from C# is  the single-line 
> lambdas (https://msdn.microsoft.com/en-us/library/bb397687.aspx).
>
> Essentially:
>
> auto func = (a, b, c) => a + b + c;
>
> Would be the same as:
>
> auto func = [](auto a, auto b, auto c) { return a + b + c;};
>

Because C++ is more complex than C#, what it converts to should be more 
complex than that, involving `noexcept` and `decltype` deduction of the 
return expression (for SFINAE purposes). There's a more full discussion of 
this sort of thing here 
<https://groups.google.com/a/isocpp.org/d/topic/std-proposals/uu7mRNXnf8Q/discussion>
..

However, don't get your hopes up for typeless parameters. 

-- 
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/db9eb530-1da1-47d2-98f5-a4c08ec43cd4%40isocpp.org.

------=_Part_93_150103289.1481059855091
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, December 5, 2016 at 5:33:29 PM UTC-5, Erich Kea=
ne wrote:<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">On F=
riday, December 2, 2016 at 6:49:08 AM UTC-8, <a>wm201...@gmail.com</a> wrot=
e:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Good code vs.Bad=
 Code<br><br>#define LAMBA [=3D]<br><br>menu1.callback(&quot;Log-&gt;Clear&=
quot;, LAMBDA() {dosomething1(); dosomthing2()});<br><br>^^^ Abouve with In=
ferred last semi-colon: LOOKS GOOD, but a compiler error.=C2=A0 <br>Why not=
 make=20
it legal to infer the last semicolon in a curly brace block? <br><br><br>Co=
mpiles... but the syntax gets on your nerves:<br><br>=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 menu1.callback(&quot;Log-&gt;Clear&quot;, [=3D]() {do=
something1(); dosomthing2();}); //extra semicolon at the end<br><br><br>sur=
e Laugh now.=C2=A0 But all those semicolons add up in a large program...<br=
><br><br>Actually while we are on this one.=C2=A0 I always like the &quot;p=
erl feature of allowing extra &quot;commas&quot; when defining a list.=C2=
=A0 this feature sames a huge amount of lot of time when writing programs t=
hat write programs without all the extra garbage code needed to detect the =
end of list to remove comma at the end of the list:<br><br>GOOD:=C2=A0 (tha=
nk you perl)<br>=C2=A0 vector&lt;string&gt; blah {<br>=C2=A0=C2=A0=C2=A0 &q=
uot;one&quot;,<br>=C2=A0=C2=A0=C2=A0 &quot;two&quot;,<br>=C2=A0=C2=A0=C2=A0=
 &quot;three&quot;,=C2=A0 // &lt;=3D extra comma ok... ignored without warn=
<br>=C2=A0 };<br><br>BAD: (no thanks c++: lighten up a little bit c++ compi=
ler... )<br>=C2=A0 vector&lt;string&gt; blah {<br>=C2=A0=C2=A0=C2=A0 &quot;=
one&quot;,<br>=C2=A0=C2=A0=C2=A0 &quot;two&quot;,<br>. =C2=A0=C2=A0 &quot;t=
hree&quot;=C2=A0 // &lt;=3D=3D=3D no comma allowed here... now all of my lo=
ops need extra if block to detect end of list when writing programs that wr=
ite programs...<br>=C2=A0 };<br><br>now you are asking... why on earth woul=
d anybody ever want to write a program that writes a program?<br>it happens=
 more often than you think...<br><br><br><br></div></blockquote><div>This s=
eems like a pretty minor thing, I&#39;m not a huge fan of changing the gram=
mar that much in the name of saving single characters.=C2=A0 Others have me=
ntioned the many problems with automatic return type.<br><br>That said, 1 f=
eature that I REALLY miss from C# is=C2=A0 the single-line lambdas (<a href=
=3D"https://msdn.microsoft.com/en-us/library/bb397687.aspx" target=3D"_blan=
k" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.google.com/=
url?q\x3dhttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fbb397687.aspx=
\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFGTkM_EIcg3_Z5Ey5orDnUlH0i0g&#39;;=
return true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dh=
ttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fbb397687.aspx\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNFGTkM_EIcg3_Z5Ey5orDnUlH0i0g&#39;;return tru=
e;">https://msdn.microsoft.com/<wbr>en-us/library/bb397687.aspx</a>).<br><b=
r>Essentially:<br><br>auto func =3D (a, b, c) =3D&gt; a + b + c;<br><br>Wou=
ld be the same as:<br><br>auto func =3D [](auto a, auto b, auto c) { return=
 a + b + c;};<br></div></div></blockquote><div><br>Because C++ is more comp=
lex than C#, what it converts to should be more complex than that, involvin=
g `noexcept` and `decltype` deduction of the return expression (for SFINAE =
purposes). There&#39;s a <a href=3D"https://groups.google.com/a/isocpp.org/=
d/topic/std-proposals/uu7mRNXnf8Q/discussion">more full discussion of this =
sort of thing here</a>.<br><br>However, don&#39;t get your hopes up for typ=
eless parameters. <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/db9eb530-1da1-47d2-98f5-a4c08ec43cd4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/db9eb530-1da1-47d2-98f5-a4c08ec43cd4=
%40isocpp.org</a>.<br />

------=_Part_93_150103289.1481059855091--

------=_Part_92_1533801044.1481059855091--

.
