220 29674 <7ac0450f-1fe9-4787-bfba-5bde4c08abb8@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Erich Keane <erich.keane@verizon.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: compiler should infer last semicolon of culy
 brace block... it makes lambas look better....
Date: Mon, 5 Dec 2016 14:33:28 -0800 (PST)
Lines: 139
Approved: news@gmane.org
Message-ID: <7ac0450f-1fe9-4787-bfba-5bde4c08abb8@isocpp.org>
References: <99df401b-562e-424f-9c17-01575f8b47e1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_335_1063609167.1480977208895"
X-Trace: blaine.gmane.org 1480977211 14236 195.159.176.226 (5 Dec 2016 22:33:31 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 5 Dec 2016 22:33:31 +0000 (UTC)
Cc: wm2015email@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCWZXNPJO4ILTVUXYICRUBH7ZXPIC@isocpp.org Mon Dec 05 23:33:27 2016
Return-path: <std-proposals+bncBCWZXNPJO4ILTVUXYICRUBH7ZXPIC@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f69.google.com ([209.85.218.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCWZXNPJO4ILTVUXYICRUBH7ZXPIC@isocpp.org>)
	id 1cE1p8-0002bR-JP
	for gclcip-std-proposals@m.gmane.org; Mon, 05 Dec 2016 23:33:26 +0100
Original-Received: by mail-oi0-f69.google.com with SMTP id j198sf577302901oih.5
        for <gclcip-std-proposals@m.gmane.org>; Mon, 05 Dec 2016 14:33:30 -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=JsdO5s5O/8WIzhyq0gPbPN4q1t34kAWdEwTxFOA8tuM=;
        b=L00R6BpwGTWRtjfRD6LIRuoR9txKY1+Z2ZX2cWBMyMknO8D7192ZvWF3ieA/lXgkom
         GA6DVxqJRixRzEi+9TZ4pvxrLwIDw3ro3qMi8gmMKg1zZSHZs3spEBuMdGBMYIYjpiXG
         WJE25pNxLkEnW2hDrz87NFkmc9q9MHtaFxXnxuKu6R7n2RzGI6LkIe/AJ8vGMlNSoNUC
         rSRzDo+twaYnuQu2uB0S8agtI8/UU8IahuWvVAdWfULX32TfL0SlC+3xG64rQzIN6nmK
         nU6aE+Kq32HbYS8VNScIb4SU3GF7XY0S2Wg7c6J7aMGlO2DCRQhb8A1DKDG2e0iVKfCt
         HIEg==
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=JsdO5s5O/8WIzhyq0gPbPN4q1t34kAWdEwTxFOA8tuM=;
        b=A82VzBqsxonl9PAFiT3yaLqsR41DaZEvlfwXgXoJ/FakcWnIbvjTawMAqzwsjeRgBh
         IeGtLAIxJG9Bu9A2dpii9KsBMQB5PHoCJbKQFlQhblZa+Af45XzQCSwLw7m0i5y62sQI
         rxtWeOwiAwjTfMe45uExaaVeoPx1nNoANo0/bqaT6KLDjQd3T1p4AkOHSJIkiMwUbK4l
         TcKzse0PEFZz9wMyCXG5/FTIEf1c2ivknKo4U+PGstHmwnBVBaD4ylmmi3ZbqFmJAkat
         SIADdGoI0flZfRM3Xc4MDdrIDLCUzYM8uxLyFLIK8Qp1CeDdfHYAD4UG80RhEG29NKyA
         7BWg==
X-Gm-Message-State: AKaTC03WjpH8kPQ+WhbaVGOegr9UDa8JVyS6y1hJmVQHOZXyqDX22mzq+YYY2VWbHi0DlQ==
X-Received: by 10.157.36.43 with SMTP id p40mr13814806ota.102.1480977210299;
        Mon, 05 Dec 2016 14:33:30 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.52.171 with SMTP id g40ls28247058otc.47.gmail; Mon, 05 Dec
 2016 14:33:29 -0800 (PST)
X-Received: by 10.157.44.172 with SMTP id p41mr3806994otb.6.1480977209594;
        Mon, 05 Dec 2016 14:33:29 -0800 (PST)
In-Reply-To: <99df401b-562e-424f-9c17-01575f8b47e1@isocpp.org>
X-Original-Sender: erich.keane@verizon.net
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:29674
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29674>

------=_Part_335_1063609167.1480977208895
Content-Type: multipart/alternative; 
	boundary="----=_Part_336_1141249221.1480977208895"

------=_Part_336_1141249221.1480977208895
Content-Type: text/plain; charset=UTF-8

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;};

-- 
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/7ac0450f-1fe9-4787-bfba-5bde4c08abb8%40isocpp.org.

------=_Part_336_1141249221.1480977208895
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, December 2, 2016 at 6:49:08 AM UTC-8, wm201...@=
gmail.com 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"lt=
r">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 Inferred 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 (https:/=
/msdn.microsoft.com/en-us/library/bb397687.aspx).<br><br>Essentially:<br><b=
r>auto func =3D (a, b, c) =3D&gt; a + b + c;<br><br>Would be the same as:<b=
r><br>auto func =3D [](auto a, auto b, auto c) { return a + b + c;};<br></d=
iv></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/7ac0450f-1fe9-4787-bfba-5bde4c08abb8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7ac0450f-1fe9-4787-bfba-5bde4c08abb8=
%40isocpp.org</a>.<br />

------=_Part_336_1141249221.1480977208895--

------=_Part_335_1063609167.1480977208895--

.
