Topic: a new 'also' keyword
Author: cory.beutler@imsar.us
Date: Thu, 14 Aug 2014 09:52:28 -0700 (PDT)
Raw View
------=_Part_6890_1177837391.1408035148214
Content-Type: text/plain; charset=UTF-8
The 'also' keyword would be much like 'else' in usage. Here is an example:
if (i == 0)
{
// do A
}
else if (i == 1)
{
// do B
}
also
{
// do C
}
The 'also' block would 'do C' if either A or B get executed. Here is the
current c++ equivalent:
if (i == 0)
{
// do A
// do C
}
else if (i == 1)
{
// do B
// do C
}
One could also have an 'also if' statement. This would only trigger if (1)
a previous if in the if-else chain was triggered and (2) the if condition
was true.
Example:
if (i == 0)
{
// do A
}
else if (i == 1)
{
// do B
}
also if (j < 2)
{
// do C
}
The current c++ equivalent:
if (i == 0)
{
// do A
}
else if (i == 1)
{
// do B
}
if ((i == 0 || i == 1) && j < 2)
{
// do C
}
Any feedback on this idea for a new keyword would be great, thanks.
--
---
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/.
------=_Part_6890_1177837391.1408035148214
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">The 'also' keyword would be much like 'else' in usage. Her=
e is an example:<br>if (i =3D=3D 0) <br>{<br> // do A<br>=
}<br>else if (i =3D=3D 1)<br>{<br> // do B<br>}<br>also<b=
r>{<br> // do C<br>}<br><br>The 'also' block would 'do C'=
if either A or B get executed. Here is the current c++ equivalent:<br>if (=
i =3D=3D 0) <br>{<br> // do A<br> // do=
C<br>}<br>else if (i =3D=3D 1)<br>{<br> // do B<br> =
; // do C<br>}<br><br>One could also have an 'also if' statemen=
t. This would only trigger if (1) a previous if in the if-else chain was tr=
iggered and (2) the if condition was true.<br>Example:<br>if (i =3D=3D 0)<b=
r>{<br> // do A<br>}<br>else if (i =3D=3D 1)<br>{<br>&nbs=
p; // do B<br>}<br>also if (j < 2)<br>{<br> // d=
o C<br>}<br><br>The current c++ equivalent:<br>if (i =3D=3D 0)<br>{<br>&nbs=
p; // do A<br>}<br>else if (i =3D=3D 1)<br>{<br> &nb=
sp; // do B<br>}<br>if ((i =3D=3D 0 || i =3D=3D 1) && j < 2)<br>=
{<br> // do C<br>}<br><br>Any feedback on this idea for a new k=
eyword would be great, thanks.<br></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_6890_1177837391.1408035148214--
.
Author: Pablo Oliva <pabloliva87@gmail.com>
Date: Thu, 14 Aug 2014 14:35:33 -0300
Raw View
--089e0158c3aceec52005009a5415
Content-Type: text/plain; charset=UTF-8
Inlined comment below.
2014-08-14 13:52 GMT-03:00 <cory.beutler@imsar.us>:
> The 'also' keyword would be much like 'else' in usage. Here is an example:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> also
> {
> // do C
> }
>
> The 'also' block would 'do C' if either A or B get executed. Here is the
> current c++ equivalent:
> if (i == 0)
> {
> // do A
> // do C
> }
> else if (i == 1)
> {
> // do B
> // do C
> }
>
> One could also have an 'also if' statement. This would only trigger if (1)
> a previous if in the if-else chain was triggered and (2) the if condition
> was true.
> Example:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> also if (j < 2)
> {
> // do C
> }
>
> The current c++ equivalent:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> if ((i == 0 || i == 1) && j < 2)
> {
> // do C
> }
>
This equivalence only holds if neither A nor B modify the value of i.
Exactly when would the condition of the "also if" be evaluated?
>
> Any feedback on this idea for a new keyword would be great, thanks.
>
What is the goal of this addition to the language? Is it to ease
readability only?
Best regards.
>
> --
>
> ---
> 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/.
>
--
---
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/.
--089e0158c3aceec52005009a5415
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra">Inlined comment below.<br><br><=
div class=3D"gmail_quote">2014-08-14 13:52 GMT-03:00 <span dir=3D"ltr"><=
;<a href=3D"mailto:cory.beutler@imsar.us" target=3D"_blank">cory.beutler@im=
sar.us</a>></span>:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">The 'also' keyword =
would be much like 'else' in usage. Here is an example:<br>if (i =
=3D=3D 0) <br>
{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else if (i =3D=3D 1)<br>{<br>=C2=A0=
=C2=A0=C2=A0 // do B<br>}<br>also<br>{<br>=C2=A0=C2=A0=C2=A0 // do C<br>}<b=
r><br>The 'also' block would 'do C' if either A or B get ex=
ecuted. Here is the current c++ equivalent:<br>
if (i =3D=3D 0) <br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>=C2=A0=C2=A0=C2=A0 /=
/ do C<br>}<br>else if (i =3D=3D 1)<br>{<br>=C2=A0=C2=A0=C2=A0 // do B<br>=
=C2=A0=C2=A0=C2=A0 // do C<br>}<br><br>One could also have an 'also if&=
#39; statement. This would only trigger if (1) a previous if in the if-else=
chain was triggered and (2) the if condition was true.<br>
Example:<br>if (i =3D=3D 0)<br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else=
if (i =3D=3D 1)<br>{<br>=C2=A0=C2=A0=C2=A0 // do B<br>}<br>also if (j <=
2)<br>{<br>=C2=A0=C2=A0 // do C<br>}<br><br>The current c++ equivalent:<br=
>if (i =3D=3D 0)<br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else if (i =3D=
=3D 1)<br>
{<br>=C2=A0=C2=A0=C2=A0 // do B<br>}<br>if ((i =3D=3D 0 || i =3D=3D 1) &=
;& j < 2)<br>{<br>=C2=A0=C2=A0 // do C<br>}<br></div></blockquote><d=
iv>This equivalence only holds if neither A nor B modify the value of i.</d=
iv><div>Exactly when would the condition of the "also if" be eval=
uated?=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br>Any feedback on this id=
ea for a new keyword would be great, thanks.</div></blockquote><div>What is=
the goal of this addition to the language? Is it to ease readability only?=
</div>
<div><br></div><div>Best regards.</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><span class=3D"HOEnZb"><font color=3D"#888888"><br></font></spa=
n></div>
<span class=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
<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+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--089e0158c3aceec52005009a5415--
.
Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Thu, 14 Aug 2014 20:10:59 +0200
Raw View
--001a11c35e22a4533805009ad3a5
Content-Type: text/plain; charset=UTF-8
You can express this as follows:
auto C = [&]
{
// do C
};
if (i == 0)
{
// do A
C();
}
else if (i == 1)
{
// do B
C();
}
where C is an identifier that describes what C does.
I don't think this situation is common enough to warrant a language feature
specifically for it.
Our policy from on-high is "we need more complicated control statements
like we need a hole in the head".
On Thu, Aug 14, 2014 at 6:52 PM, <cory.beutler@imsar.us> wrote:
> The 'also' keyword would be much like 'else' in usage. Here is an example:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> also
> {
> // do C
> }
>
> The 'also' block would 'do C' if either A or B get executed. Here is the
> current c++ equivalent:
> if (i == 0)
> {
> // do A
> // do C
> }
> else if (i == 1)
> {
> // do B
> // do C
> }
>
> One could also have an 'also if' statement. This would only trigger if (1)
> a previous if in the if-else chain was triggered and (2) the if condition
> was true.
> Example:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> also if (j < 2)
> {
> // do C
> }
>
> The current c++ equivalent:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> if ((i == 0 || i == 1) && j < 2)
> {
> // do C
> }
>
> Any feedback on this idea for a new keyword would be great, thanks.
>
> --
>
> ---
> 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/.
>
--
---
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/.
--001a11c35e22a4533805009ad3a5
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">You can express this as follows:<div><br></div><div>auto C=
=3D [&]</div><div>{</div><div>=C2=A0 =C2=A0 // do C</div><div>};</div>=
<div><br></div><div>if (i =3D=3D 0)</div><div>{</div><div>=C2=A0 =C2=A0 // =
do A</div><div>=C2=A0 =C2=A0C();</div>
<div>}</div><div>else if (i =3D=3D 1)</div><div>{</div><div>=C2=A0 =C2=A0 /=
/ do B</div><div>=C2=A0 =C2=A0 C();</div><div>}</div><div><br></div><div>wh=
ere C is an identifier that describes what C does.</div><div><br></div><div=
>I don't think this situation is common enough to warrant a language fe=
ature specifically for it.</div>
<div><br></div><div>Our policy from on-high is "we need more complicat=
ed control statements like we need a hole in the head".</div><div><br>=
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Thu, Aug 14, 2=
014 at 6:52 PM, <span dir=3D"ltr"><<a href=3D"mailto:cory.beutler@imsar=
..us" target=3D"_blank">cory.beutler@imsar.us</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">The 'also' keyword =
would be much like 'else' in usage. Here is an example:<br>if (i =
=3D=3D 0) <br>
{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else if (i =3D=3D 1)<br>{<br>=C2=A0=
=C2=A0=C2=A0 // do B<br>}<br>also<br>{<br>=C2=A0=C2=A0=C2=A0 // do C<br>}<b=
r><br>The 'also' block would 'do C' if either A or B get ex=
ecuted. Here is the current c++ equivalent:<br>
if (i =3D=3D 0) <br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>=C2=A0=C2=A0=C2=A0 /=
/ do C<br>}<br>else if (i =3D=3D 1)<br>{<br>=C2=A0=C2=A0=C2=A0 // do B<br>=
=C2=A0=C2=A0=C2=A0 // do C<br>}<br><br>One could also have an 'also if&=
#39; statement. This would only trigger if (1) a previous if in the if-else=
chain was triggered and (2) the if condition was true.<br>
Example:<br>if (i =3D=3D 0)<br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else=
if (i =3D=3D 1)<br>{<br>=C2=A0=C2=A0=C2=A0 // do B<br>}<br>also if (j <=
2)<br>{<br>=C2=A0=C2=A0 // do C<br>}<br><br>The current c++ equivalent:<br=
>if (i =3D=3D 0)<br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else if (i =3D=
=3D 1)<br>
{<br>=C2=A0=C2=A0=C2=A0 // do B<br>}<br>if ((i =3D=3D 0 || i =3D=3D 1) &=
;& j < 2)<br>{<br>=C2=A0=C2=A0 // do C<br>}<br><br>Any feedback on t=
his idea for a new keyword would be great, thanks.<span><font color=3D"#888=
888"><br></font></span></div>
<span><font color=3D"#888888">
<p></p>
-- <br>
<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+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a11c35e22a4533805009ad3a5--
.
Author: cory.beutler@imsar.us
Date: Thu, 14 Aug 2014 11:12:52 -0700 (PDT)
Raw View
------=_Part_164_2092140154.1408039972183
Content-Type: text/plain; charset=UTF-8
On Thursday, August 14, 2014 11:35:35 AM UTC-6, Pablo Oliva wrote:
>
> Inlined comment below.
>
> 2014-08-14 13:52 GMT-03:00 <cory.b...@imsar.us <javascript:>>:
>
>> The 'also' keyword would be much like 'else' in usage. Here is an example:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> also
>> {
>> // do C
>> }
>>
>> The 'also' block would 'do C' if either A or B get executed. Here is the
>> current c++ equivalent:
>> if (i == 0)
>> {
>> // do A
>> // do C
>> }
>> else if (i == 1)
>> {
>> // do B
>> // do C
>> }
>>
>> One could also have an 'also if' statement. This would only trigger if
>> (1) a previous if in the if-else chain was triggered and (2) the if
>> condition was true.
>> Example:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> also if (j < 2)
>> {
>> // do C
>> }
>>
>> The current c++ equivalent:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> if ((i == 0 || i == 1) && j < 2)
>> {
>> // do C
>> }
>>
> This equivalence only holds if neither A nor B modify the value of i.
> Exactly when would the condition of the "also if" be evaluated?
>
Good catch on noticing the inequivalent case.
>
>> Any feedback on this idea for a new keyword would be great, thanks.
>>
> What is the goal of this addition to the language? Is it to ease
> readability only?
>
The goal of adding the 'also' keyword would be to simplify some logic
blocks. I have had many cases where I want to execute the same 10 lines of
code if any of the previous else-if blocks succeeded. The only options
would be to copy-pase the code to the end of each, or add a boolean to the
end of each one that is then used to trigger the 10 lines later. I don't
find either of these particularly clean or optimal. This could also save a
few cycles or some ram since there could essentially be a 'goto' jump in
the assembly at the end of each if-else block that goes to the also block.
(I have actually seen a goto used in this way... sadly.)
In short, it would improve readability, but also have a few small side
benefits. I just don't know if this solves a common enough problem to
justify its addition to the language.
>
> Best regards.
>
>>
>> --
>>
>> ---
>> 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-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--
---
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/.
------=_Part_164_2092140154.1408039972183
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, August 14, 2014 11:35:35 AM UTC-6, Pa=
blo Oliva 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"><div>Inlined comment below.<br><br><div class=3D"gmail_quote">2014-08-14=
13:52 GMT-03:00 <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_=
blank" gdf-obfuscated-mailto=3D"aKGntIiV26YJ" onmousedown=3D"this.href=3D'j=
avascript:';return true;" onclick=3D"this.href=3D'javascript:';return true;=
">cory.b...@imsar.us</a>></span>:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">The 'also' keyword would be=
much like 'else' in usage. Here is an example:<br>if (i =3D=3D 0) <br>
{<br> // do A<br>}<br>else if (i =3D=3D 1)<br>{<br> =
// do B<br>}<br>also<br>{<br> // do C<br>}<b=
r><br>The 'also' block would 'do C' if either A or B get executed. Here is =
the current c++ equivalent:<br>
if (i =3D=3D 0) <br>{<br> // do A<br> /=
/ do C<br>}<br>else if (i =3D=3D 1)<br>{<br> // do B<br>&=
nbsp; // do C<br>}<br><br>One could also have an 'also if' stat=
ement. This would only trigger if (1) a previous if in the if-else chain wa=
s triggered and (2) the if condition was true.<br>
Example:<br>if (i =3D=3D 0)<br>{<br> // do A<br>}<br>else=
if (i =3D=3D 1)<br>{<br> // do B<br>}<br>also if (j <=
2)<br>{<br> // do C<br>}<br><br>The current c++ equivalent:<br=
>if (i =3D=3D 0)<br>{<br> // do A<br>}<br>else if (i =3D=
=3D 1)<br>
{<br> // do B<br>}<br>if ((i =3D=3D 0 || i =3D=3D 1) &=
;& j < 2)<br>{<br> // do C<br>}<br></div></blockquote><d=
iv>This equivalence only holds if neither A nor B modify the value of i.</d=
iv><div>Exactly when would the condition of the "also if" be evaluated?&nbs=
p;</div></div></div></div></blockquote><div>Good catch on noticing the ineq=
uivalent case. <br></div><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">
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br>Any feedback on this id=
ea for a new keyword would be great, thanks.</div></blockquote><div>What is=
the goal of this addition to the language? Is it to ease readability only?=
</div></div></div></div></blockquote><div>The goal of adding the 'also' key=
word would be to simplify some logic blocks. I have had many cases where I =
want to execute the same 10 lines of code if any of the previous else-if bl=
ocks succeeded. The only options would be to copy-pase the code to the end =
of each, or add a boolean to the end of each one that is then used to trigg=
er the 10 lines later. I don't find either of these particularly clean or o=
ptimal. This could also save a few cycles or some ram since there could ess=
entially be a 'goto' jump in the assembly at the end of each if-else block =
that goes to the also block. (I have actually seen a goto used in this way.=
... sadly.)<br>In short, it would improve readability, but also have a few s=
mall side benefits. I just don't know if this solves a common enough proble=
m to justify its addition to the language.<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc soli=
d;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote">
<div><br></div><div>Best regards.</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><span><font color=3D"#888888"><br></font></span></div>
<span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
aKGntIiV26YJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"aKGntIiV26YJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</font></span></blockquote></div><br></div></div>
</blockquote></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_164_2092140154.1408039972183--
.
Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Thu, 14 Aug 2014 20:17:24 +0200
Raw View
--047d7b339befa3034b05009aea61
Content-Type: text/plain; charset=UTF-8
On Thu, Aug 14, 2014 at 8:12 PM, <cory.beutler@imsar.us> wrote:
> The goal of adding the 'also' keyword would be to simplify some logic
> blocks. I have had many cases where I want to execute the same 10 lines of
> code if any of the previous else-if blocks succeeded. The only options
> would be to copy-pase the code to the end of each, or add a boolean to the
> end of each one that is then used to trigger the 10 lines later. I don't
> find either of these particularly clean or optimal.
>
Another way would be:
if (i == 0)
{
// do A
}
else if (i == 1)
{
// do B
}
else goto skip_C;
{
// do C
} skip_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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--047d7b339befa3034b05009aea61
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
hu, Aug 14, 2014 at 8:12 PM, <span dir=3D"ltr"><<a href=3D"mailto:cory.=
beutler@imsar.us" target=3D"_blank">cory.beutler@imsar.us</a>></span> wr=
ote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr"><div class=3D"">The goal of adding the 'also' keyw=
ord would be to simplify some logic blocks. I have had many cases where I w=
ant to execute the same 10 lines of code if any of the previous else-if blo=
cks succeeded. The only options would be to copy-pase the code to the end o=
f each, or add a boolean to the end of each one that is then used to trigge=
r the 10 lines later. I don't find either of these particularly clean o=
r optimal.</div>
</div></blockquote><div><br></div><div></div></div><br></div><div class=3D"=
gmail_extra">Another way would be:</div><div class=3D"gmail_extra"><br></di=
v><div class=3D"gmail_extra">=C2=A0 =C2=A0 if (i =3D=3D 0)</div><div class=
=3D"gmail_extra">=C2=A0 =C2=A0 {</div>
<div class=3D"gmail_extra">=C2=A0 =C2=A0 =C2=A0 =C2=A0 // do A</div><div cl=
ass=3D"gmail_extra">=C2=A0 =C2=A0 }</div><div class=3D"gmail_extra">=C2=A0 =
=C2=A0 else if (i =3D=3D 1)</div><div class=3D"gmail_extra">=C2=A0 =C2=A0 {=
</div><div class=3D"gmail_extra">=C2=A0 =C2=A0 =C2=A0 =C2=A0 // do B</div><=
div class=3D"gmail_extra">
=C2=A0 =C2=A0 }</div><div class=3D"gmail_extra">=C2=A0 =C2=A0 else goto ski=
p_C;</div><div class=3D"gmail_extra">=C2=A0 =C2=A0 {</div><div class=3D"gma=
il_extra">=C2=A0 =C2=A0 =C2=A0 =C2=A0 // do C</div><div class=3D"gmail_extr=
a">=C2=A0 =C2=A0 } skip_C:;</div><div class=3D"gmail_extra"><br></div>
</div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--047d7b339befa3034b05009aea61--
.
Author: cory.beutler@imsar.us
Date: Thu, 14 Aug 2014 11:27:46 -0700 (PDT)
Raw View
------=_Part_591_9598219.1408040866815
Content-Type: text/plain; charset=UTF-8
On Thursday, August 14, 2014 12:11:01 PM UTC-6, Andrew Tomazos wrote:
>
> You can express this as follows:
>
> auto C = [&]
> {
> // do C
> };
>
> if (i == 0)
> {
> // do A
> C();
> }
> else if (i == 1)
> {
> // do B
> C();
> }
>
> where C is an identifier that describes what C does.
>
Ah, lambda functions. I do like those. I am stuck using 98 right now and
keep forgetting about them.
> I don't think this situation is common enough to warrant a language
> feature specifically for it.
>
> Our policy from on-high is "we need more complicated control statements
> like we need a hole in the head".
>
I like that policy. I keep waffling on whether or not this is a common
problem. I run into a place this can be used ever 1-2 months and keep
thinking it would be nice to have.
The idea seems simple enough that I think it wouldn't be too bad to add (at
least 'also' is not too complicated; 'also if' could be a little too
ambiguous.) Also, since the syntax is similar to an 'else' and the english
meaning is clear, it seems like it would not be a hard thing for people to
wrap their heads around. I mean, I already had someone correct my
equivalence after seeing it for the first time ever.
At any rate, I can understand the fear of adding it. It may open the door
to many other weird control flow garbage. I won't be heartbroken if it
never happens.
>
>
> On Thu, Aug 14, 2014 at 6:52 PM, <cory.b...@imsar.us <javascript:>> wrote:
>
>> The 'also' keyword would be much like 'else' in usage. Here is an example:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> also
>> {
>> // do C
>> }
>>
>> The 'also' block would 'do C' if either A or B get executed. Here is the
>> current c++ equivalent:
>> if (i == 0)
>> {
>> // do A
>> // do C
>> }
>> else if (i == 1)
>> {
>> // do B
>> // do C
>> }
>>
>> One could also have an 'also if' statement. This would only trigger if
>> (1) a previous if in the if-else chain was triggered and (2) the if
>> condition was true.
>> Example:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> also if (j < 2)
>> {
>> // do C
>> }
>>
>> The current c++ equivalent:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> if ((i == 0 || i == 1) && j < 2)
>> {
>> // do C
>> }
>>
>> Any feedback on this idea for a new keyword would be great, thanks.
>>
>> --
>>
>> ---
>> 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-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--
---
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/.
------=_Part_591_9598219.1408040866815
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, August 14, 2014 12:11:01 PM UTC-6, Andrew Tom=
azos 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">Yo=
u can express this as follows:<div><br></div><div>auto C =3D [&]</div><=
div>{</div><div> // do C</div><div>};</div><div><br></div><div=
>if (i =3D=3D 0)</div><div>{</div><div> // do A</div><div>&nbs=
p; C();</div>
<div>}</div><div>else if (i =3D=3D 1)</div><div>{</div><div> /=
/ do B</div><div> C();</div><div>}</div><div><br></div><div>wh=
ere C is an identifier that describes what C does.</div></div></blockquote>=
<div> </div><div>Ah, lambda functions. I do like those. I am stuck usi=
ng 98 right now and keep forgetting about them.<br><br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></div><div>I don't=
think this situation is common enough to warrant a language feature specif=
ically for it.</div>
<div><br></div><div>Our policy from on-high is "we need more complicated co=
ntrol statements like we need a hole in the head".</div></div></blockquote>=
<div><br>I like that policy. I keep waffling on whether or not this is a co=
mmon problem. I run into a place this can be used ever 1-2 months and keep&=
nbsp; thinking it would be nice to have.<br>The idea seems simple enough th=
at I think it wouldn't be too bad to add (at least 'also' is not too compli=
cated; 'also if' could be a little too ambiguous.) Also, since the syntax i=
s similar to an 'else' and the english meaning is clear, it seems like it w=
ould not be a hard thing for people to wrap their heads around. I mean, I a=
lready had someone correct my equivalence after seeing it for the first tim=
e ever.<br>At any rate, I can understand the fear of adding it. It may open=
the door to many other weird control flow garbage. I won't be heartbroken =
if it never happens.<br> </div><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><br><div><br><div class=3D"gmail_quote">On Thu,=
Aug 14, 2014 at 6:52 PM, <span dir=3D"ltr"><<a href=3D"javascript:" ta=
rget=3D"_blank" gdf-obfuscated-mailto=3D"Md7GWKzRcwMJ" onmousedown=3D"this.=
href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';ret=
urn true;">cory.b...@imsar.us</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">The 'also' keyword would be=
much like 'else' in usage. Here is an example:<br>if (i =3D=3D 0) <br>
{<br> // do A<br>}<br>else if (i =3D=3D 1)<br>{<br> =
// do B<br>}<br>also<br>{<br> // do C<br>}<b=
r><br>The 'also' block would 'do C' if either A or B get executed. Here is =
the current c++ equivalent:<br>
if (i =3D=3D 0) <br>{<br> // do A<br> /=
/ do C<br>}<br>else if (i =3D=3D 1)<br>{<br> // do B<br>&=
nbsp; // do C<br>}<br><br>One could also have an 'also if' stat=
ement. This would only trigger if (1) a previous if in the if-else chain wa=
s triggered and (2) the if condition was true.<br>
Example:<br>if (i =3D=3D 0)<br>{<br> // do A<br>}<br>else=
if (i =3D=3D 1)<br>{<br> // do B<br>}<br>also if (j <=
2)<br>{<br> // do C<br>}<br><br>The current c++ equivalent:<br=
>if (i =3D=3D 0)<br>{<br> // do A<br>}<br>else if (i =3D=
=3D 1)<br>
{<br> // do B<br>}<br>if ((i =3D=3D 0 || i =3D=3D 1) &=
;& j < 2)<br>{<br> // do C<br>}<br><br>Any feedback on t=
his idea for a new keyword would be great, thanks.<span><font color=3D"#888=
888"><br></font></span></div>
<span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
Md7GWKzRcwMJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"Md7GWKzRcwMJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_591_9598219.1408040866815--
.
Author: Edward Catmur <ed@catmur.co.uk>
Date: Thu, 14 Aug 2014 22:08:15 -0700 (PDT)
Raw View
Another solution is to wrap the whole if else chain in an immediate lambda and return out of the else block:
[&]{
if (...) ...;
else if (...) ...;
else return;
... // also
}();
Obviously this precludes early return statements appearing anywhere in the above, but from the description of your use case I don't think that would be a problem.
The C++03/C pattern would have been to use a do... while(0) loop with break in the else; I may have used that myself once or twice.
--
---
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/.
.
Author: David Krauss <potswa@gmail.com>
Date: Fri, 15 Aug 2014 22:59:11 +0800
Raw View
--Apple-Mail=_A76F362E-01EE-47D9-8482-5075CA057E96
Content-Type: text/plain; charset=ISO-8859-1
On 2014-08-15, at 1:08 PM, Edward Catmur <ed@catmur.co.uk> wrote:
> Obviously this precludes early return statements appearing anywhere in the above, but from the description of your use case I don't think that would be a problem.
Another trick with lambdas would be to imitate a pure functional language with no statement vs. expression distinction.
( cond_a && [&] { action_a(); return true; } ()
|| cond_b && [&] { action_b(); return true; } ()
|| cond_c && [&] { action_c(); return true; } ()
) && [&] { action_also(); } ();
> The C++03/C pattern would have been to use a do... while(0) loop with break in the else; I may have used that myself once or twice.
In other words a goto. Another way to obtain that structure, without actually saying goto, is an if-else chain in a switch.
switch ( cond ) {
if (0)
case a: {
action_a();
} else if (0)
case b: {
action_b();
} else if (0)
case c: {
action_c();
}
action_also();
}
Neither of these are really advisable; I'd probably just use goto or a flag or something.
I do think that the proposal solves a problem. But, it seems like rough waters for new control flow structures.
--
---
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/.
--Apple-Mail=_A76F362E-01EE-47D9-8482-5075CA057E96
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;08–15, at 1:08 PM, Edward Catmur <<a href=3D"mailto:ed@catmu=
r.co.uk">ed@catmur.co.uk</a>> wrote:</div><br class=3D"Apple-interchange=
-newline"><blockquote type=3D"cite">Obviously this precludes early return s=
tatements appearing anywhere in the above, but from the description of your=
use case I don't think that would be a problem. <br></blockquote><div><br>=
</div><div>Another trick with lambdas would be to imitate a pure functional=
language with no statement vs. expression distinction.</div><div><br></div=
><div><font face=3D"Courier">( cond_a && [&] { action_a(=
); return true; } ()</font></div><div><font face=3D"Courier"> || cond_=
b && [&] { action_b(); return true; } ()</font></div><div><font=
face=3D"Courier"> || cond_c && [&] { action_c(); return t=
rue; } ()</font></div><div><font face=3D"Courier">) && [&] { ac=
tion_also(); } ();</font></div><div><br></div><blockquote type=3D"cite">The=
C++03/C pattern would have been to use a do... while(0) loop with break in=
the else; I may have used that myself once or twice.<br></blockquote><div>=
<br></div><div>In other words a <font face=3D"Courier">goto</font>. Another=
way to obtain that structure, without actually saying goto, is an if-else =
chain in a switch.</div><div><br></div><div><font face=3D"Courier">switch (=
cond ) {</font></div><div><font face=3D"Courier">if (0)</font></div><div><=
font face=3D"Courier">case a: {</font></div><div><font face=3D"Courier">&nb=
sp; action_a();</font></div><div><font face=3D"Courier"><br></font><=
/div><div><font face=3D"Courier">} else if (0)</font></div><div><font face=
=3D"Courier">case b: {</font></div><div><font face=3D"Courier">  =
; action_b();</font></div><div><div><font face=3D"Courier"><br></font></div=
><div><font face=3D"Courier">} else if (0)</font></div><div><font face=3D"C=
ourier">case c: {</font></div><div><font face=3D"Courier"> act=
ion_c();</font></div><div><font face=3D"Courier">}</font></div><div><font f=
ace=3D"Courier"> action_also();</font></div><div><font face=3D=
"Courier">}</font></div><div><br></div><div>Neither of these are really adv=
isable; I’d probably just use <font face=3D"Courier">goto</font> or a=
flag or something.</div><div><br></div><div>I do think that the proposal s=
olves a problem. But, it seems like rough waters for new control flow struc=
tures.</div><div><br></div></div></div></body></html>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--Apple-Mail=_A76F362E-01EE-47D9-8482-5075CA057E96--
.
Author: cory.beutler@imsar.us
Date: Fri, 15 Aug 2014 08:50:06 -0700 (PDT)
Raw View
------=_Part_684_2101173295.1408117807044
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Friday, August 15, 2014 8:59:19 AM UTC-6, David Krauss wrote:
>
>
> On 2014=E2=80=9308=E2=80=9315, at 1:08 PM, Edward Catmur <e...@catmur.co.=
uk <javascript:>>=20
> wrote:
>
> Obviously this precludes early return statements appearing anywhere in th=
e=20
> above, but from the description of your use case I don't think that would=
=20
> be a problem.=20
>
>
> Another trick with lambdas would be to imitate a pure functional language=
=20
> with no statement vs. expression distinction.
>
> ( cond_a && [&] { action_a(); return true; } ()
> || cond_b && [&] { action_b(); return true; } ()
> || cond_c && [&] { action_c(); return true; } ()
> ) && [&] { action_also(); } ();
>
> The C++03/C pattern would have been to use a do... while(0) loop with=20
> break in the else; I may have used that myself once or twice.
>
>
> In other words a goto. Another way to obtain that structure, without=20
> actually saying goto, is an if-else chain in a switch.
>
> switch ( cond ) {
> if (0)
> case a: {
> action_a();
>
> } else if (0)
> case b: {
> action_b();
>
> } else if (0)
> case c: {
> action_c();
> }
> action_also();
> }
>
> Neither of these are really advisable; I=E2=80=99d probably just use goto=
or a=20
> flag or something.
>
> I do think that the proposal solves a problem. But, it seems like rough=
=20
> waters for new control flow structures.
>
>
That's a good way to put it: Solves a problem, but could be a bad idea for=
=20
the future of c++ flow.
I think it is interesting how everyone seems to have seen this problem and=
=20
has many ways of solving it. There are close to 10 solutions on here now.=
=20
Some are easy to read, some not so much. The fact that everyone has a=20
solution that they have even used several times before seems to ague the=20
case that perhaps a standard simplification is due.
I do like what is being done with the language. I think a lot of the new=20
features really simplify code and make things easier to understand (for the=
=20
most part. Lambda functions are a bit weird, especially if your new to the=
=20
concept.) Whether or not the 'also' keyword would be good for the language=
=20
is a tough call, it seems. I actually thought of it while designing by own=
=20
programming language. To me, it seems as useful as the else statement. For=
=20
example, nested if statements could be broken out using the also statement,=
=20
more specifically, the also-if. Here is another example.
current C++ version:
if (/*condition A*/)
{
//do A
if (/*condition B*/)
{
//do B
}
}
'also' version:
if (/*condition A*/)
{
//do A
}
also if (/*condition B*/)
{
//do B
}
This levels many complex nested if statements. I have seen if statement=20
that are 4-5 deep that could turn into a beautiful linear chain with this.=
=20
The inner if doesn't even need to be at the end of the outer if:
current C++ version:
if (/*condition A*/)
{
//do A
if (/*condition B*/)
{
//do B
}
//do C
}
'also' version:
if (/*condition A*/)
{
//do A
}
also if (/*condition B*/)
{
//do B
}
also
{
//do C
}
Now, like has been said many times already, I don't know if this is more=20
clear or not. Perhaps it is not. I am more familiar with the old syntax, so=
=20
I am bias toward the current way of drawing out the loops, but I thought it=
=20
would be worth bringing before the council of internet programming wizards.
I appreciate all the feedback given thus-far. It has helped me in thinking=
=20
about the designs for my aforementioned programming language. I appreciate=
=20
your value of simplicity. You guys are doing a good job. Thanks again for=
=20
that. (C++ is my favourite language.)
--=20
---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_684_2101173295.1408117807044
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, August 15, 2014 8:59:19 AM UTC-6, David=
Krauss wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D"wo=
rd-wrap:break-word"><br><div><div>On 2014=E2=80=9308=E2=80=9315, at 1:08 PM=
, Edward Catmur <<a href=3D"javascript:" target=3D"_blank" gdf-obfuscate=
d-mailto=3D"N8__lsCquNsJ" onmousedown=3D"this.href=3D'javascript:';return t=
rue;" onclick=3D"this.href=3D'javascript:';return true;">e...@catmur.co.uk<=
/a>> wrote:</div><br><blockquote type=3D"cite">Obviously this precludes =
early return statements appearing anywhere in the above, but from the descr=
iption of your use case I don't think that would be a problem. <br></blockq=
uote><div><br></div><div>Another trick with lambdas would be to imitate a p=
ure functional language with no statement vs. expression distinction.</div>=
<div><br></div><div><font face=3D"Courier">( cond_a && [&=
;] { action_a(); return true; } ()</font></div><div><font face=3D"Courier">=
|| cond_b && [&] { action_b(); return true; } ()</font></=
div><div><font face=3D"Courier"> || cond_c && [&] { action=
_c(); return true; } ()</font></div><div><font face=3D"Courier">) &&=
; [&] { action_also(); } ();</font></div><div><br></div><blockquote typ=
e=3D"cite">The C++03/C pattern would have been to use a do... while(0) loop=
with break in the else; I may have used that myself once or twice.<br></bl=
ockquote><div><br></div><div>In other words a <font face=3D"Courier">goto</=
font>. Another way to obtain that structure, without actually saying goto, =
is an if-else chain in a switch.</div><div><br></div><div><font face=3D"Cou=
rier">switch ( cond ) {</font></div><div><font face=3D"Courier">if (0)</fon=
t></div><div><font face=3D"Courier">case a: {</font></div><div><font face=
=3D"Courier"> action_a();</font></div><div><font face=3D"Couri=
er"><br></font></div><div><font face=3D"Courier">} else if (0)</font></div>=
<div><font face=3D"Courier">case b: {</font></div><div><font face=3D"Courie=
r"> action_b();</font></div><div><div><font face=3D"Courier"><=
br></font></div><div><font face=3D"Courier">} else if (0)</font></div><div>=
<font face=3D"Courier">case c: {</font></div><div><font face=3D"Courier">&n=
bsp; action_c();</font></div><div><font face=3D"Courier">}</font></d=
iv><div><font face=3D"Courier"> action_also();</font></div><di=
v><font face=3D"Courier">}</font></div><div><br></div><div>Neither of these=
are really advisable; I=E2=80=99d probably just use <font face=3D"Courier"=
>goto</font> or a flag or something.</div><div><br></div><div>I do think th=
at the proposal solves a problem. But, it seems like rough waters for new c=
ontrol flow structures.</div><div><br></div></div></div></div></blockquote>=
<div><br>That's a good way to put it: Solves a problem, but could be a bad =
idea for the future of c++ flow.<br><br>I think it is interesting how every=
one seems to have seen this problem and has many ways of solving it. There =
are close to 10 solutions on here now. Some are easy to read, some not so m=
uch. The fact that everyone has a solution that they have even used several=
times before seems to ague the case that perhaps a standard simplification=
is due.<br><br>I do like what is being done with the language. I think a l=
ot of the new features really simplify code and make things easier to under=
stand (for the most part. Lambda functions are a bit weird, especially if y=
our new to the concept.) Whether or not the 'also' keyword would be good fo=
r the language is a tough call, it seems. I actually thought of it while de=
signing by own programming language. To me, it seems as useful as the else =
statement. For example, nested if statements could be broken out using the =
also statement, more specifically, the also-if. Here is another example.<br=
><br>current C++ version:<br><br>if (/*condition A*/)<br>{<br> &=
nbsp; //do A<br> if (/*condition B*/)<br> &nbs=
p; {<br> //do B<br> &n=
bsp; }<br>}<br><br>'also' version:<br><br>if (/*condition A*/)<br>{<br>&nbs=
p; //do A<br>}<br>also if (/*condition B*/)<br>{<br>  =
; //do B<br>}<br><br>This levels many complex nested if statements. I have =
seen if statement that are 4-5 deep that could turn into a beautiful linear=
chain with this. The inner if doesn't even need to be at the end of the ou=
ter if:<br><br>current C++ version:<br><br>if (/*condition A*/)<br>{<br>&nb=
sp; //do A<br> if (/*condition B*/)<br> =
{<br> //do B<br>&nbs=
p; }<br> //do C<br>}<br><br>'also' version:<b=
r><br>if (/*condition A*/)<br>{<br> //do A<br>}<br>also i=
f (/*condition B*/)<br>{<br> //do B<br>}<br>also<br>{<br>=
//do C<br>}<br><br>Now, like has been said many times al=
ready, I don't know if this is more clear or not. Perhaps it is not. I am m=
ore familiar with the old syntax, so I am bias toward the current way of dr=
awing out the loops, but I thought it would be worth bringing before the co=
uncil of internet programming wizards.<br>I appreciate all the feedback giv=
en thus-far. It has helped me in thinking about the designs for my aforemen=
tioned programming language. I appreciate your value of simplicity. You guy=
s are doing a good job. Thanks again for that. (C++ is my favourite languag=
e.)<br></div></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_684_2101173295.1408117807044--
.
Author: David Krauss <potswa@gmail.com>
Date: Sat, 16 Aug 2014 07:09:02 +0800
Raw View
--Apple-Mail=_2145D1A7-D3BF-4FD3-BE53-9209E8D00D97
Content-Type: text/plain; charset=ISO-8859-1
On 2014-08-15, at 11:50 PM, cory.beutler@imsar.us wrote:
> Whether or not the 'also' keyword would be good for the language is a tough call, it seems. I actually thought of it while designing by own programming language. To me, it seems as useful as the else statement.
also seems to be parallel with else. Python for example has a while...else construct to execute a block if a loop body never ran, but no way to run a block only if the loop did run (http://stackoverflow.com/a/24676661/153285).
else is essentially a statement-level logical OR. also is essentially a statement-level logical AND.
Hope you pursue this further in your own language. You might have better luck proposing it to the C language than 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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--Apple-Mail=_2145D1A7-D3BF-4FD3-BE53-9209E8D00D97
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;08–15, at 11:50 PM, <a href=3D"mailto:cory.beutler@imsar.us">co=
ry.beutler@imsar.us</a> wrote:</div><br class=3D"Apple-interchange-newline"=
><blockquote type=3D"cite"><div style=3D"font-family: Helvetica; font-size:=
12px; font-style: normal; font-variant: normal; font-weight: normal; lette=
r-spacing: normal; line-height: normal; orphans: auto; text-align: start; t=
ext-indent: 0px; text-transform: none; white-space: normal; widows: auto; w=
ord-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir=3D"ltr">Whether=
or not the 'also' keyword would be good for the language is a tough call, =
it seems. I actually thought of it while designing by own programming langu=
age. To me, it seems as useful as the else statement.</div></div></blockquo=
te><div><br></div><div><font face=3D"Courier">also</font> seems to be paral=
lel with <font face=3D"Courier">else</font>. Python for example has a <font=
face=3D"Courier">while</font>…<font face=3D"Courier">else</font> co=
nstruct to execute a block if a loop body never ran, but no way to run a bl=
ock only if the loop did run (<a href=3D"http://stackoverflow.com/a/2467666=
1/153285">http://stackoverflow.com/a/24676661/153285</a>).</div><div><br></=
div><div><font face=3D"Courier">else</font> is essentially a statement-leve=
l logical OR. <font face=3D"Courier">also</font> is essentially a statement=
-level logical AND.</div><div><br></div></div>Hope you pursue this further =
in your own language. You might have better luck proposing it to the C lang=
uage than C++.<br><div><br></div></body></html>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--Apple-Mail=_2145D1A7-D3BF-4FD3-BE53-9209E8D00D97--
.
Author: Tony V E <tvaneerd@gmail.com>
Date: Wed, 20 Aug 2014 16:05:11 -0400
Raw View
--047d7b3a83ae1b87cd0501151f3d
Content-Type: text/plain; charset=UTF-8
On Thu, Aug 14, 2014 at 12:52 PM, <cory.beutler@imsar.us> wrote:
> The 'also' keyword would be much like 'else' in usage. Here is an example:
> if (i == 0)
> {
> // do A
> }
> else if (i == 1)
> {
> // do B
> }
> also
> {
> // do C
> }
>
>
It would be hard, syntactically, for the 'also' to know that it is in a
"chain" of if/else-ifs. Note that 'else if' isn't a keyword, but two
separate keywords that happen to be next to each other. The 'if' is just
the start of the next statement, which happens to be on the same line as
the 'else' ie
if (X)
doA();
else if (Y)
doB();
is really:
if (X)
doA();
else
if (Y)
doB();
ie
if (X) {
doA();
} else {
if (Y) {
doB();
}
}
so your example becomes
if (i == 0)
{
// do A
}
else
{
if (i == 1)
{
// do B
}
also
{
// do C
}
}
So the 'also' has lost track of the original if.
Unless you want to change how else-if is done. So it may be a bigger
change than you think.
Tony
--
---
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/.
--047d7b3a83ae1b87cd0501151f3d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Thu, Aug 14, 2014 at 12:52 PM, <span dir=3D"ltr"><<a href=3D=
"mailto:cory.beutler@imsar.us" target=3D"_blank">cory.beutler@imsar.us</a>&=
gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">The '=
;also' keyword would be much like 'else' in usage. Here is an e=
xample:<br>
if (i =3D=3D 0) <br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else if (i =3D=
=3D 1)<br>{<br>=C2=A0=C2=A0=C2=A0 // do B<br>}<br>also<br>{<br>=C2=A0=C2=A0=
=C2=A0 // do C<br>}<br><br></div></blockquote><div><br></div><div>It would =
be hard, syntactically, for the 'also' to know that it is in a &quo=
t;chain" of if/else-ifs.=C2=A0 Note that 'else if' isn't a=
keyword, but two separate keywords that happen to be next to each other.=
=C2=A0 The 'if' is just the start of the next statement, which happ=
ens to be on the same line as the 'else' ie<br>
<br>if (X)<br>=C2=A0=C2=A0 doA();<br>else if (Y)<br>=C2=A0=C2=A0 doB();<br>=
<br>is really:<br><br>if (X)<br>=C2=A0=C2=A0 doA();<br>else<br>=C2=A0=C2=A0=
=C2=A0 if (Y)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 doB();<br><br></div><=
div>ie<br><br></div><div>if (X) {<br>=C2=A0=C2=A0 doA();<br>} else {<br>=C2=
=A0=C2=A0=C2=A0 if (Y) {<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 doB();<br>=C2=A0=C2=A0=C2=A0 }<br>}<br=
><br></div><div>so your example becomes<br></div><div><br>if (i =3D=3D 0) <=
br>{<br>=C2=A0=C2=A0=C2=A0 // do A<br>}<br>else<br>{<br>=C2=A0=C2=A0=C2=A0 =
if (i =3D=3D 1)<br>=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 // do B<br>=C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 also<br>=
=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0 // do C<br>
=C2=A0=C2=A0=C2=A0 }<br></div></div>}<br><br></div><div class=3D"gmail_extr=
a">So the 'also' has lost track of the original if.<br></div><div c=
lass=3D"gmail_extra">Unless you want to change how else-if is done.=C2=A0 S=
o it may be a bigger change than you think.<br>
<br><br></div><div class=3D"gmail_extra">Tony<br></div></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--047d7b3a83ae1b87cd0501151f3d--
.
Author: cory.beutler@imsar.us
Date: Wed, 20 Aug 2014 14:38:03 -0700 (PDT)
Raw View
------=_Part_14_1818652972.1408570683371
Content-Type: text/plain; charset=UTF-8
Ah, i didn't realize that 'else' and 'if' where kept separate. It makes
perfect sense, though. I guess I just saw 'elif' in other languages and the
lack of indent changes and assumed the parser smushed them together in c++.
Your example illustrates beautifully that that is not the case. That would
indeed result in a bigger change to the underlying structure of things.
With that added enlightenment, I think it may be best not to include it, at
least not at this time. I am hashing out more use cases and things for the
'also', and I may write a paper on it if I find good results to my
research. Something that changes such a basic piece of the control flow of
programs should, most likely, have more research behind it anyway. The
'also' may return.
On Wednesday, August 20, 2014 2:05:13 PM UTC-6, Tony V E wrote:
>
>
>
>
> On Thu, Aug 14, 2014 at 12:52 PM, <cory.b...@imsar.us <javascript:>>
> wrote:
>
>> The 'also' keyword would be much like 'else' in usage. Here is an example:
>> if (i == 0)
>> {
>> // do A
>> }
>> else if (i == 1)
>> {
>> // do B
>> }
>> also
>> {
>> // do C
>> }
>>
>>
> It would be hard, syntactically, for the 'also' to know that it is in a
> "chain" of if/else-ifs. Note that 'else if' isn't a keyword, but two
> separate keywords that happen to be next to each other. The 'if' is just
> the start of the next statement, which happens to be on the same line as
> the 'else' ie
>
> if (X)
> doA();
> else if (Y)
> doB();
>
> is really:
>
> if (X)
> doA();
> else
> if (Y)
> doB();
>
> ie
>
> if (X) {
> doA();
> } else {
> if (Y) {
> doB();
> }
> }
>
> so your example becomes
>
> if (i == 0)
> {
> // do A
> }
> else
> {
> if (i == 1)
> {
> // do B
> }
> also
> {
> // do C
> }
> }
>
> So the 'also' has lost track of the original if.
> Unless you want to change how else-if is done. So it may be a bigger
> change than you think.
>
>
> Tony
>
--
---
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/.
------=_Part_14_1818652972.1408570683371
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Ah, i didn't realize that 'else' and 'if' where kept separ=
ate. It makes perfect sense, though. I guess I just saw 'elif' in other lan=
guages and the lack of indent changes and assumed the parser smushed them t=
ogether in c++. Your example illustrates beautifully that that is not the c=
ase. That would indeed result in a bigger change to the underlying structur=
e of things. With that added enlightenment, I think it may be best not to i=
nclude it, at least not at this time. I am hashing out more use cases and t=
hings for the 'also', and I may write a paper on it if I find good results =
to my research. Something that changes such a basic piece of the control fl=
ow of programs should, most likely, have more research behind it anyway. Th=
e 'also' may return.<br><br>On Wednesday, August 20, 2014 2:05:13 PM UTC-6,=
Tony V E 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"><br><div><br><br><div class=3D"gmail_quote">On Thu, Aug 14, 2014 at 12:5=
2 PM, <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-=
obfuscated-mailto=3D"0eEzRwlahUIJ" onmousedown=3D"this.href=3D'javascript:'=
;return true;" onclick=3D"this.href=3D'javascript:';return true;">cory.b...=
@imsar.us</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">The 'als=
o' keyword would be much like 'else' in usage. Here is an example:<br>
if (i =3D=3D 0) <br>{<br> // do A<br>}<br>else if (i =3D=
=3D 1)<br>{<br> // do B<br>}<br>also<br>{<br> =
// do C<br>}<br><br></div></blockquote><div><br></div><div>It would =
be hard, syntactically, for the 'also' to know that it is in a "chain" of i=
f/else-ifs. Note that 'else if' isn't a keyword, but two separate key=
words that happen to be next to each other. The 'if' is just the star=
t of the next statement, which happens to be on the same line as the 'else'=
ie<br>
<br>if (X)<br> doA();<br>else if (Y)<br> doB();<br>=
<br>is really:<br><br>if (X)<br> doA();<br>else<br> =
if (Y)<br> doB();<br><br></div><=
div>ie<br><br></div><div>if (X) {<br> doA();<br>} else {<br>&nb=
sp; if (Y) {<br>
doB();<br> }<br>}<br=
><br></div><div>so your example becomes<br></div><div><br>if (i =3D=3D 0) <=
br>{<br> // do A<br>}<br>else<br>{<br> =
if (i =3D=3D 1)<br> {<br> &n=
bsp; // do B<br> }<br> also<br>&n=
bsp; {<br> // do C<br>
}<br></div></div>}<br><br></div><div>So the 'also' has l=
ost track of the original if.<br></div><div>Unless you want to change how e=
lse-if is done. So it may be a bigger change than you think.<br>
<br><br></div><div>Tony<br></div></div>
</blockquote></div>
<p></p>
-- <br />
<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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_14_1818652972.1408570683371--
.