Topic: compiler should infer last semicolon of culy
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 2 Dec 2016 17:01:00 +0200
Raw View
On 2 December 2016 at 16:49, <wm2015email@gmail.com> wrote:
> 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...
> };
A comma is allowed there.
--
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/CAFk2RUZpzgM%2BCFYAj_HeknB1-c1ZAg_L5e29BjSWdnKM4PW2jg%40mail.gmail.com.
.
Author: Jakob Riedle <jakob.riedle@gmail.com>
Date: Fri, 2 Dec 2016 07:14:20 -0800 (PST)
Raw View
------=_Part_730_759639917.1480691660881
Content-Type: multipart/alternative;
boundary="----=_Part_731_567246139.1480691660881"
------=_Part_731_567246139.1480691660881
Content-Type: text/plain; charset=UTF-8
>
> A comma is allowed there
Truly...
*Concerning your Idea:*
I like it!
Another Idea: How about making the "return" stmt obsolete, *when there is
no semicolon *(only within a lambda)? How about being able to write
transform(begin(str), end(str), [](auto c){ toupper(c) } );
*Why I said it: *Because making "return" optional when there is no
semicolon makes it a backwards-compatible change!
Just an idea...
--
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/a09f1541-1574-4eed-a030-60a485510436%40isocpp.org.
------=_Part_731_567246139.1480691660881
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">=
A comma is allowed there</blockquote><div><br></div><div>Truly...</div><div=
><br></div><div><b>Concerning your Idea:</b></div><div>I like it!</div><div=
><br></div><div><br></div><div>Another Idea: How about making the "ret=
urn" stmt obsolete, <b>when there is no semicolon </b>(only within a l=
ambda)? How about being able to write</div><div><br></div><div><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: #000;" class=3D"styled-by-prettify">transform</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">begin</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">str</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">),</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">end</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">str</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">),</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">[](</span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> c</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">){</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> toupper</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">c</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: #660;" class=3D"styled-by-prettify">}</span><span style=3D"co=
lor: #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"><br></span></div></code></div></div><div><br></div>=
<div><b>Why I said it: </b>Because making "return" optional when =
there is no semicolon makes it a backwards-compatible change!</div><div><br=
></div><div>Just an idea...</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/a09f1541-1574-4eed-a030-60a485510436%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a09f1541-1574-4eed-a030-60a485510436=
%40isocpp.org</a>.<br />
------=_Part_731_567246139.1480691660881--
------=_Part_730_759639917.1480691660881--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 2 Dec 2016 08:34:29 -0800 (PST)
Raw View
------=_Part_884_1915619394.1480696469605
Content-Type: multipart/alternative;
boundary="----=_Part_885_2086958458.1480696469606"
------=_Part_885_2086958458.1480696469606
Content-Type: text/plain; charset=UTF-8
On Friday, December 2, 2016 at 10:14:20 AM UTC-5, Jakob Riedle wrote:
>
> A comma is allowed there
>
>
> Truly...
>
> *Concerning your Idea:*
> I like it!
>
>
> Another Idea: How about making the "return" stmt obsolete, *when there is
> no semicolon *(only within a lambda)? How about being able to write
>
> transform(begin(str), end(str), [](auto c){ toupper(c) } );
>
> *Why I said it: *Because making "return" optional when there is no
> semicolon makes it a backwards-compatible change!
>
> Just an idea...
>
Look at how it conflicts with what the OP wanted:
menu1.callback("Log->Clear", [=]() {dosomething1(); dosomthing2()});
With his feature, this is still a `void` function. With what you want, it's
equivalent to `return dosomething2()`. That might be `void` or it might
not. There's no way to tell.
There are already some ideas around for making lambda-as-single-expression
easier to write.
--
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/5876fa59-f31f-4b93-969a-8ab0437f2f55%40isocpp.org.
------=_Part_885_2086958458.1480696469606
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, December 2, 2016 at 10:14:20 AM UTC-5, =
Jakob Riedle wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left:1px solid rgb(204,204,204);padding-left:1ex">A comma is allowed =
there</blockquote><div><br></div><div>Truly...</div><div><br></div><div><b>=
Concerning your Idea:</b></div><div>I like it!</div><div><br></div><div><br=
></div><div>Another Idea: How about making the "return" stmt obso=
lete, <b>when there is no semicolon </b>(only within a lambda)? How about b=
eing able to write</div><div><br></div><div><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">transfo=
rm</span><span style=3D"color:#660">(</span><span style=3D"color:#008">begi=
n</span><span style=3D"color:#660">(</span><span style=3D"color:#000">str</=
span><span style=3D"color:#660">),</span><span style=3D"color:#000"> </span=
><span style=3D"color:#008">end</span><span style=3D"color:#660">(</span><s=
pan style=3D"color:#000">str</span><span style=3D"color:#660">),</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">[](</span><span s=
tyle=3D"color:#008">auto</span><span style=3D"color:#000"> c</span><span st=
yle=3D"color:#660">){</span><span style=3D"color:#000"> toupper</span><span=
style=3D"color:#660">(</span><span style=3D"color:#000">c</span><span styl=
e=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">}</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">);</span><span style=3D"color:#000"><br></span></div></code></div></=
div><div><br></div><div><b>Why I said it: </b>Because making "return&q=
uot; optional when there is no semicolon makes it a backwards-compatible ch=
ange!</div><div><br></div><div>Just an idea...</div></div></blockquote><div=
><br>Look at how it conflicts with what the OP wanted:<br><br><div style=3D=
"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bo=
rder-style: solid; border-width: 1px; overflow-wrap: break-word;" class=3D"=
prettyprint"><code class=3D"prettyprint"><div class=3D"subprettyprint"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">menu1</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">callback</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #080;" =
class=3D"styled-by-prettify">"Log->Clear"</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">[=3D]()</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">dosomething1</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">();</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> dosomthing2</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">()});</span></div></code></div><br>With his feature, this is still a `vo=
id` function. With what you want, it's equivalent to `return dosomethin=
g2()`. That might be `void` or it might not. There's no way to tell.<br=
><br>There are already some ideas around for making lambda-as-single-expres=
sion easier to write.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/5876fa59-f31f-4b93-969a-8ab0437f2f55%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5876fa59-f31f-4b93-969a-8ab0437f2f55=
%40isocpp.org</a>.<br />
------=_Part_885_2086958458.1480696469606--
------=_Part_884_1915619394.1480696469605--
.
Author: Jakob Riedle <jakob.riedle@gmail.com>
Date: Fri, 2 Dec 2016 12:15:43 -0800 (PST)
Raw View
------=_Part_928_1144731838.1480709743415
Content-Type: multipart/alternative;
boundary="----=_Part_929_956700343.1480709743415"
------=_Part_929_956700343.1480709743415
Content-Type: text/plain; charset=UTF-8
>
> That might be `void` or it might not. There's no way to tell.
Well, there is also no way to tell, whether "return dosomething2()" is void.
Look here for an Example <http://ideone.com/TLAqSY>.
Does this even answer the concerns that you had?
Well, you're right, that single-expression-lambdas are THE solution.
Jakob
--
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/da79b48a-99ac-4f12-86ff-28792fccf5d6%40isocpp.org.
------=_Part_929_956700343.1480709743415
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">=
That might be `void` or it might not. There's no way to tell.</blockquo=
te><div><br></div><div>Well, there is also no way to tell, whether "re=
turn dosomething2()" is void.</div><div>Look here for an=C2=A0<a href=
=3D"http://ideone.com/TLAqSY">Example</a>.</div><div>Does this even answer =
the concerns that you had?</div><div><br></div><div>Well, you're right,=
that single-expression-lambdas are THE solution.</div><div><br></div><div>=
Jakob</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/da79b48a-99ac-4f12-86ff-28792fccf5d6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/da79b48a-99ac-4f12-86ff-28792fccf5d6=
%40isocpp.org</a>.<br />
------=_Part_929_956700343.1480709743415--
------=_Part_928_1144731838.1480709743415--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 2 Dec 2016 12:20:46 -0800 (PST)
Raw View
------=_Part_795_1561579492.1480710046795
Content-Type: multipart/alternative;
boundary="----=_Part_796_1810344412.1480710046795"
------=_Part_796_1810344412.1480710046795
Content-Type: text/plain; charset=UTF-8
On Friday, December 2, 2016 at 3:15:43 PM UTC-5, Jakob Riedle wrote:
>
> That might be `void` or it might not. There's no way to tell.
>
>
> Well, there is also no way to tell, whether "return dosomething2()" is
> void.
> Look here for an Example <http://ideone.com/TLAqSY>.
> Does this even answer the concerns that you had?
>
My point is that it isn't clear whether the user *wanted* "return
dosomething2()` or whether they just wanted to *call* `dosomething2()`.
That's why, if we're going to elide the last semicolon in the block, doing
that should not change the meaning of the last statement.
--
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/d293b81b-1153-4aef-a253-6d7ab8d168aa%40isocpp.org.
------=_Part_796_1810344412.1480710046795
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Friday, December 2, 2016 at 3:15:43 PM UTC-5, Jakob Rie=
dle 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"><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">That might be `void` or it m=
ight not. There's no way to tell.</blockquote><div><br></div><div>Well,=
there is also no way to tell, whether "return dosomething2()" is=
void.</div><div>Look here for an=C2=A0<a href=3D"http://ideone.com/TLAqSY"=
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://=
www.google.com/url?q\x3dhttp%3A%2F%2Fideone.com%2FTLAqSY\x26sa\x3dD\x26sntz=
\x3d1\x26usg\x3dAFQjCNFeU4usX54TQakMZH4C2dkJZcw0qg';return true;" oncli=
ck=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fideone.c=
om%2FTLAqSY\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFeU4usX54TQakMZH4C2dkJZ=
cw0qg';return true;">Example</a>.</div><div>Does this even answer the c=
oncerns that you had?</div></div></blockquote><div><br>My point is that it =
isn't clear whether the user <i>wanted</i> "return dosomething2()`=
or whether they just wanted to <i>call</i> `dosomething2()`. That's wh=
y, if we're going to elide the last semicolon in the block, doing that =
should not change the meaning of the last statement.</div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/d293b81b-1153-4aef-a253-6d7ab8d168aa%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d293b81b-1153-4aef-a253-6d7ab8d168aa=
%40isocpp.org</a>.<br />
------=_Part_796_1810344412.1480710046795--
------=_Part_795_1561579492.1480710046795--
.
Author: Daniel Boles <db0451@gmail.com>
Date: Fri, 02 Dec 2016 20:43:11 +0000
Raw View
For sure, that seems to be an irresolvable ambiguity that makes
'implied return' a non-starter.
The optional semicolon is cute, I guess, but hardly the main issue with
expressions of the complexity cited here.
--
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/1480711391.2485.1.camel%40gmail.com.
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sun, 4 Dec 2016 10:44:22 +0000
Raw View
--001a11410152b1c0c80542d2dad7
Content-Type: text/plain; charset=UTF-8
The C/C++ rules on semicolons in statements (not declarations) are a bit
odd in contrast to other languages like Pascal, where semicolons are
required only between statements in a compound statement (I am using C
syntax to show this):
{S1;S2;...;Sn}
But, it also mean that a semicolon is not used before "else" (we could look
into this as well, whether it is viable option):
if (a>b) then x=a else x = b
But, in C/C++, there is the ugly switch statement, where semicolons are
probably required as well.
In addition, in some languages, the value {S1;S2;...;Sn} is the value of Sn
if it is the last executed statement/expression; otherwise it is the value
of the expression in the return statement.
All this can probably be implemented in C++, but all the syntactic
ambiguities should be carefully examined.
An then we will be able to write
[&y](int x) { y += x; x }
On 2 December 2016 at 20:43, Daniel Boles <db0451@gmail.com> wrote:
> For sure, that seems to be an irresolvable ambiguity that makes
> 'implied return' a non-starter.
>
> The optional semicolon is cute, I guess, but hardly the main issue with
> expressions of the complexity cited here.
>
> --
> 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/1480711391.2485.1.camel%40gmail.com.
>
--
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/CAMeU-s36yo6iSW7kn%2BD9ZGAZzcgUEg9MQ6O0vfc9U-JjjzQi6A%40mail.gmail.com.
--001a11410152b1c0c80542d2dad7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>The C/C++ rules on semicolons in statements (not decl=
arations) are a bit odd in contrast to other languages like Pascal, where=
=C2=A0 semicolons are required only between statements in a compound statem=
ent (I am using C syntax to show this):</div><div>{S1;S2;...;Sn}</div><div>=
<br></div><div>But, it also mean that a semicolon is not used before "=
else" (we could look into this as well, whether it is viable option):<=
/div><div>if (a>b) then x=3Da else x =3D b</div><div><br></div><div>But,=
in C/C++, there is the=C2=A0ugly switch statement, where semicolons are pr=
obably required as well.</div><div><br></div><div><br></div><div>In additio=
n, in some languages, the value {S1;S2;...;Sn} is the value of Sn if it is =
the last executed statement/expression; otherwise it is the value of the ex=
pression in the return statement.</div><div><br></div><div>All this can pro=
bably be implemented in C++, but all the syntactic ambiguities should be ca=
refully examined.</div><div><br></div><div>An then we will be able to write=
</div><div>[&y](int x) { y +=3D x; x }</div><div><br></div><div><br></d=
iv><div><br></div><div><br></div></div><div class=3D"gmail_extra"><br><div =
class=3D"gmail_quote">On 2 December 2016 at 20:43, Daniel Boles <span dir=
=3D"ltr"><<a href=3D"mailto:db0451@gmail.com" target=3D"_blank">db0451@g=
mail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For sure=
, that seems to be an irresolvable ambiguity that makes<br>
'implied return' a non-starter.<br>
<br>
The optional semicolon is cute, I guess, but hardly the main issue with<br>
expressions of the complexity cited here.<br>
<span><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@<wbr>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>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/1480711391.2485.1.camel%40gmai=
l.com" target=3D"_blank" rel=3D"noreferrer">https://groups.google.com/a/<wb=
r>isocpp.org/d/msgid/std-<wbr>proposals/1480711391.2485.1.<wbr>camel%40gmai=
l.com</a>.<br>
</blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAMeU-s36yo6iSW7kn%2BD9ZGAZzcgUEg9MQ6=
O0vfc9U-JjjzQi6A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMeU-s36yo6iSW=
7kn%2BD9ZGAZzcgUEg9MQ6O0vfc9U-JjjzQi6A%40mail.gmail.com</a>.<br />
--001a11410152b1c0c80542d2dad7--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Sun, 4 Dec 2016 15:37:18 -0800 (PST)
Raw View
------=_Part_1291_1052106847.1480894638975
Content-Type: multipart/alternative;
boundary="----=_Part_1292_1401740628.1480894638975"
------=_Part_1292_1401740628.1480894638975
Content-Type: text/plain; charset=UTF-8
On Friday, December 2, 2016 at 8:20:46 PM UTC, Nicol Bolas wrote:
>
> On Friday, December 2, 2016 at 3:15:43 PM UTC-5, Jakob Riedle wrote:
>>
>> That might be `void` or it might not. There's no way to tell.
>>
>>
>> Well, there is also no way to tell, whether "return dosomething2()" is
>> void.
>> Look here for an Example <http://ideone.com/TLAqSY>.
>> Does this even answer the concerns that you had?
>>
>
> My point is that it isn't clear whether the user *wanted* "return
> dosomething2()` or whether they just wanted to *call* `dosomething2()`.
> That's why, if we're going to elide the last semicolon in the block, doing
> that should not change the meaning of the last statement.
>
>
why is that an issue? if the lambda was not supposed to return anything the
result would be dropped anyway. If it is, then either the code works as
intended or the compiler will complain loudly if the returned type is not
of the expected type.
--
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/c86e8800-702a-40a0-aa95-d139bbf88d62%40isocpp.org.
------=_Part_1292_1401740628.1480894638975
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Friday, December 2, 2016 at 8:20:46 PM UTC, Nicol Bolas=
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 Fri=
day, December 2, 2016 at 3:15:43 PM UTC-5, Jakob Riedle wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr"><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex">That might be `void` or it might not. There's no way=
to tell.</blockquote><div><br></div><div>Well, there is also no way to tel=
l, whether "return dosomething2()" is void.</div><div>Look here f=
or an=C2=A0<a href=3D"http://ideone.com/TLAqSY" rel=3D"nofollow" target=3D"=
_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fideone.com%2FTLAqSY\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFeU4us=
X54TQakMZH4C2dkJZcw0qg';return true;" onclick=3D"this.href=3D'http:=
//www.google.com/url?q\x3dhttp%3A%2F%2Fideone.com%2FTLAqSY\x26sa\x3dD\x26sn=
tz\x3d1\x26usg\x3dAFQjCNFeU4usX54TQakMZH4C2dkJZcw0qg';return true;">Exa=
mple</a>.</div><div>Does this even answer the concerns that you had?</div><=
/div></blockquote><div><br>My point is that it isn't clear whether the =
user <i>wanted</i> "return dosomething2()` or whether they just wanted=
to <i>call</i> `dosomething2()`. That's why, if we're going to eli=
de the last semicolon in the block, doing that should not change the meanin=
g of the last statement.</div><br></div></blockquote><div><br>why is that a=
n issue? if the lambda was not supposed to return anything the result would=
be dropped anyway. If it is, then either the code works as intended or the=
compiler will complain loudly if the returned type is not of the expected =
type.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/c86e8800-702a-40a0-aa95-d139bbf88d62%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c86e8800-702a-40a0-aa95-d139bbf88d62=
%40isocpp.org</a>.<br />
------=_Part_1292_1401740628.1480894638975--
------=_Part_1291_1052106847.1480894638975--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 4 Dec 2016 17:34:59 -0800 (PST)
Raw View
------=_Part_1286_212158984.1480901699600
Content-Type: multipart/alternative;
boundary="----=_Part_1287_1252500515.1480901699601"
------=_Part_1287_1252500515.1480901699601
Content-Type: text/plain; charset=UTF-8
On Sunday, December 4, 2016 at 6:37:19 PM UTC-5, Giovanni Piero Deretta
wrote:
>
> On Friday, December 2, 2016 at 8:20:46 PM UTC, Nicol Bolas wrote:
>>
>> On Friday, December 2, 2016 at 3:15:43 PM UTC-5, Jakob Riedle wrote:
>>>
>>> That might be `void` or it might not. There's no way to tell.
>>>
>>>
>>> Well, there is also no way to tell, whether "return dosomething2()" is
>>> void.
>>> Look here for an Example <http://ideone.com/TLAqSY>.
>>> Does this even answer the concerns that you had?
>>>
>>
>> My point is that it isn't clear whether the user *wanted* "return
>> dosomething2()` or whether they just wanted to *call* `dosomething2()`.
>> That's why, if we're going to elide the last semicolon in the block, doing
>> that should not change the meaning of the last statement.
>>
>>
> why is that an issue? if the lambda was not supposed to return anything
> the result would be dropped anyway. If it is, then either the code works as
> intended or the compiler will complain loudly if the returned type is not
> of the expected type.
>
The return value will be dropped at the location where the function gets
called, not by the code that called it. Furthermore, this return value
becomes part of the functor's calling type if it is deducing the return
type. If you get a function pointer from a capture-less lambda, perhaps to
pass to some C-based API, you'll get a very confusing compile error
somewhere along the line.
Ultimately, I just don't see the point in having a small syntactic change
like missing a semicolon have such a radical change in the *meaning* of a
line of code. It would be much better for us to just give people good
syntax for expression-only lambdas, while letting a missing semicolon not
change the meaning of the code. If a multi-statement lambda needs to return
something, then you need to type `return`.
--
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/fdaac8aa-fadf-4b29-a23d-93caf4033758%40isocpp.org.
------=_Part_1287_1252500515.1480901699601
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, December 4, 2016 at 6:37:19 PM UTC-5, Giovanni =
Piero Deretta wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">On Friday, December 2, 2016 at 8:20:46 PM UTC, Nicol Bolas 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 Friday, December=
2, 2016 at 3:15:43 PM UTC-5, Jakob Riedle wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">That might be `void` or it might not. There's no way to tell.</bl=
ockquote><div><br></div><div>Well, there is also no way to tell, whether &q=
uot;return dosomething2()" is void.</div><div>Look here for an=C2=A0<a=
href=3D"http://ideone.com/TLAqSY" rel=3D"nofollow" target=3D"_blank" onmou=
sedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fideo=
ne.com%2FTLAqSY\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFeU4usX54TQakMZH4C2=
dkJZcw0qg';return true;" onclick=3D"this.href=3D'http://www.google.=
com/url?q\x3dhttp%3A%2F%2Fideone.com%2FTLAqSY\x26sa\x3dD\x26sntz\x3d1\x26us=
g\x3dAFQjCNFeU4usX54TQakMZH4C2dkJZcw0qg';return true;">Example</a>.</di=
v><div>Does this even answer the concerns that you had?</div></div></blockq=
uote><div><br>My point is that it isn't clear whether the user <i>wante=
d</i> "return dosomething2()` or whether they just wanted to <i>call</=
i> `dosomething2()`. That's why, if we're going to elide the last s=
emicolon in the block, doing that should not change the meaning of the last=
statement.</div><br></div></blockquote><div><br>why is that an issue? if t=
he lambda was not supposed to return anything the result would be dropped a=
nyway. If it is, then either the code works as intended or the compiler wil=
l complain loudly if the returned type is not of the expected type.<br></di=
v></div></blockquote><div><br>The return value will be dropped at the locat=
ion where the function gets called, not by the code that called it. Further=
more, this return value becomes part of the functor's calling type if i=
t is deducing the return type. If you get a function pointer from a capture=
-less lambda, perhaps to pass to some C-based API, you'll get a very co=
nfusing compile error somewhere along the line.<br><br>Ultimately, I just d=
on't see the point in having a small syntactic change like missing a se=
micolon have such a radical change in the <i>meaning</i> of a line of code.=
It would be much better for us to just give people good syntax for express=
ion-only lambdas, while letting a missing semicolon not change the meaning =
of the code. If a multi-statement lambda needs to return something, then yo=
u need to type `return`.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/fdaac8aa-fadf-4b29-a23d-93caf4033758%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fdaac8aa-fadf-4b29-a23d-93caf4033758=
%40isocpp.org</a>.<br />
------=_Part_1287_1252500515.1480901699601--
------=_Part_1286_212158984.1480901699600--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 05 Dec 2016 13:09:29 -0800
Raw View
Em domingo, 4 de dezembro de 2016, =C3=A0s 10:44:22 PST, Mikhail Semenov es=
creveu:
> An then we will be able to write
> [&y](int x) { y +=3D x; x }
You're already able to write that.
Are you asking for the code above to change meaning?
--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--=20
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 e=
mail 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/2813015.YDe2xFeQqe%40tjmaciei-mobl1.
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 05 Dec 2016 13:10:18 -0800
Raw View
Em segunda-feira, 5 de dezembro de 2016, =C3=A0s 13:09:29 PST, Thiago Macie=
ira=20
escreveu:
> Em domingo, 4 de dezembro de 2016, =C3=A0s 10:44:22 PST, Mikhail Semenov=
=20
escreveu:
> > An then we will be able to write
> > [&y](int x) { y +=3D x; x }
>=20
> You're already able to write that.
>=20
> Are you asking for the code above to change meaning?
Oops, never mind, I missed the extra "x".
Which actually means this may not be a good idea.
--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--=20
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 e=
mail 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/15429615.MooKJHSLdQ%40tjmaciei-mobl1.
.
Author: Erich Keane <erich.keane@verizon.net>
Date: Mon, 5 Dec 2016 14:33:28 -0800 (PST)
Raw View
------=_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->Clear", 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("Log->Clear", [=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 "p=
erl feature of allowing extra "commas" 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<string> blah {<br>=C2=A0=C2=A0=C2=A0 &q=
uot;one",<br>=C2=A0=C2=A0=C2=A0 "two",<br>=C2=A0=C2=A0=C2=A0=
"three",=C2=A0 // <=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<string> blah {<br>=C2=A0=C2=A0=C2=A0 "=
one",<br>=C2=A0=C2=A0=C2=A0 "two",<br>. =C2=A0=C2=A0 "t=
hree"=C2=A0 // <=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'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> 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" 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--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 6 Dec 2016 13:30:54 -0800 (PST)
Raw View
------=_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("Log->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("Log->Clear", [=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 "p=
erl feature of allowing extra "commas" 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<string> blah {<br>=C2=A0=C2=A0=C2=A0 &q=
uot;one",<br>=C2=A0=C2=A0=C2=A0 "two",<br>=C2=A0=C2=A0=C2=A0=
"three",=C2=A0 // <=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<string> blah {<br>=C2=A0=C2=A0=C2=A0 "=
one",<br>=C2=A0=C2=A0=C2=A0 "two",<br>. =C2=A0=C2=A0 "t=
hree"=C2=A0 // <=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'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'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';=
return true;" onclick=3D"this.href=3D'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';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> 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'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'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" 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--
.